Working with Pre-defined Meta Tags and Custom Post Types

If your theme (or another plugin) uses the following Custom Post Types (CPTs), WPSSO will pre-populate its Open Graph meta tags array with standard meta tags for that type. The following CPTs are recognized:

  • article
  • book
  • music.album
  • music.playlist
  • music.radio_station
  • place
  • product
  • profile
  • video.episode
  • video.other
  • video.tv_show

By default, WordPress Posts, Pages, and unrecognized CPTs are classified as articles. Developers can hook the standard ‘wpsso_og’ filter to modify the Open Graph meta tag array as a whole, or by defining the WPSSO_FILTER_SINGLE_TAGS constant as true, can also hook individual meta tags. These individual meta tag hooks can return a string or an array of values.

Here’s a practical example showing how to set the ISBN meta tag from a custom field value for a ‘book’ CPT:

Individual meta tag filter names are constructed based on the meta tag attributes and their values. For example, the previous ISBN example filter name references the following meta tag: