Support » Plugin: Google Tag Manager for WordPress » Parent “pageCategory” wrong (picks a child category)

  • Hi,

    The var dataLayer_content = {“pageCategory”:[“dslr”]};
    but it should be {“pageCategory”:[“cameras”]};

    This only happens to two parent categories. All the other categories and child categories work fine.

    What could cause this?

    Thanks

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter photoworkout

    (@photoworkout)

    After digging a bit deeper I can see that the plugin picks the pageCategory attributed to the latest post published in the parent category. It ignores the parent category pageCategory attribute.

    Plugin Author Thomas Geiger

    (@duracelltomi)

    Hi,

    Thanks for your research.
    So just to summarize:
    – on a blog category page
    – pageCategory seems to include the wrong value

    Looking at the source code of this part: the plugin is using get_the_category() which indeed is more connected to posts and not to the taxonomy page.

    Perhaps using get_categories() could do a better job.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Parent “pageCategory” wrong (picks a child category)’ is closed to new replies.