[resolved] How to alter the original query arguments, before the $wp_query is created (2 posts)

  1. Darsain
    Posted 5 years ago #

    (search didn't help me, if you know about post solving this issue, please link)

    Problem: I have a custom taxonomy loading taxonomy-{$taxonomy}.php template, and it works as expected -> paginating by the value of get_option('posts_per_page'), but that's the problem. I need to have a custom pagination values for each custom taxonomy.

    Creating a new $wp_query inside the template file doesn't really help, because if my custom items_per_page value in a new query is lower than original posts_per_page, it results in 404 on pages bigger than max_num_page of original query, thus template file doesn't even load.

    Thats why I need to alter the arguments creating the original wp_query for particular custom taxonomy.

    I've failed in finding any awesome hook that would make this issue a breeze :(

    Is there a way how to do this without hacking the core? Or perhaps a different way how to get the custom items_per_page value working properly without altering the original query?

  2. Darsain
    Posted 5 years ago #

    I've - at least partially - solved it with hook 'option_{$optionname}'

    Here it is for someone with similar problem: http://wordpress.pastebin.com/4FEfVAV7

Topic Closed

This topic has been closed to new replies.

About this Topic