• Hi,

    I’m having trouble with WordPress SEO and one of my plugins.

    My plugin hooks a function on the_content(), and the first thing done in this function is to check is the current query is_main_query(). However, WordPress SEO seems to trigger a query in WordPress header (on the wp_head() action) which is identified as a main query.

    The result, as you can immagine, is that my function is hooked in the header of the site and in the real content part.

    Could you please tell me what exactly is hooked on wp_head() as a main query?

    Cheers,
    Julien

    https://www.ads-software.com/extend/plugins/wordpress-seo/

Viewing 3 replies - 1 through 3 (of 3 total)
  • I just had a quick look and WP SEO does not look to be running it’s own query in the head, it only uses information from the query. It does wp_reset_query() when needed, though it returns things to the original state after it’s done. I.e. if the query wasn’t the main query to begin with, and a reset is done, after WP SEO is done, it will set the query back to what it was before.

    You may want to look at other plugins to find the culprit.

    Hope this helps.

    Smile,
    Juliette

    Thread Starter ThemeAvenue

    (@themeavenue)

    Hi jrf,

    Thanks for your reply. I don’t know what changed exactly, but since one of the latest updates hooking a function to the_content(), even with a check on is_main_query() triggers that function in WordPress head. Still didn’t figure out what it is.

    You’re welcome and I’m available for hire if you’d like me to debug it in your plugin ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Query Hooked in Header as Main Query’ is closed to new replies.