0

Then I would like to get the smallest child Category of a post that belongs lots of categories (via the datalayer pageCategory used plugin called GTM4WP by Duracell Tomi).

How can I do that?

  • I had already known to get the biggest category: pageCategory.1
  • Already tried pageCategory.10 or pageCategory.length-1 but didn't work. I'm not really familiar with Javascript. Please guide me
Ngọc Kon
  • 11
  • 2

1 Answers1

0

You need to use the length of the array, but with a different syntax:

pageCategory[pageCategory.length-1]
kgrg
  • 1,605
  • 1
  • 12
  • 14