Skip Navigation

[Resolved] Populated taxonomy value on post type archive

This support ticket is created 3 years, 2 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 4 replies, has 2 voices.

Last updated by columD 3 years, 2 months ago.

Assisted by: Christian Cox.

Author
Posts
#1942579

Jamal and Christian helped me with this:
https://toolset.com/forums/topic/populate-custom-post-type-to-custom-meta-tag/

It works wonderfully. Unfortunately, the populated taxonomy value is also populating on the post type archive page for some reason. It is adding the taxonomy value of the first listed post. Is there a way to exclude that?

hidden link

<meta name="addsearch-custom-field">

#1942879

It sounds like you are trying to exclude some content from your custom header.php template on a post type archive. Is that correct? WordPress conditional tags might be useful here:
https://codex.wordpress.org/Conditional_Tags

There is a conditional for post type archives:
https://codex.wordpress.org/Conditional_Tags#A_Post_Type_Archive

#1951927

Hi Christian,

That might work! I am not familiar with PHP, will you be able to assist me with the code?

Thanks!

#1951991

Here is an example that outputs a meta tag if the current page is not an archive for post types 'post', 'book', or 'chapter':

if(! is_post_type_archive( array( 'post', 'book', 'chapter' ) )  ) {
  echo "<meta name='addsearch-custom-field'>";
}
#1956375

My issue is resolved now. Thank you!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.