WordPress.org

Ready to get started?Download WordPress

Forums

More Than One pre_get_posts Hook? (1 post)

  1. Gemfruit
    Member
    Posted 5 months ago #

    I'm using pre_get_posts within my functions.php file, and I'm just wondering if having multiple functions with the hook is good practice.

    Essentially I'll be editing tons of queries through pre_get_posts, from the number of posts on category pages, to alphabetizing on certain pages. I'd prefer to have a function controlling each task, for organizational reasons, which is why I'm curious. I can simply make one function and comment / space each "idea", but that's messier.

    So yeah, is adding multiple functions to functions.php that use pre_get_posts a bad idea, and if so, why?

Reply

You must log in to post.

About this Topic