Support » Fixing WordPress » More Than One pre_get_posts Hook?

  • Gemfruit

    (@gemfruit)


    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?

  • The topic ‘More Than One pre_get_posts Hook?’ is closed to new replies.