Adding support for Post Tags to a CPT added by a plugin


I marked Yurix’ answer as helpful although it did not solve my problem, because I did find that it sent me off in the right direction, even if it wasn’t the right solution.

I found in the plugin’s code that registered the CPT the use of $defaults to set up all the $args for the CPT and it’s custom taxonomy (to which I wanted to add post_tags) so while the code above didn’t work, by adding code to add to the $defaults, this did work:

    // Adds support for normal Post Tags to FAQs
    function my_faq_defaults( $defaults ) {
    $defaults['post_type']['args']['taxonomies'] = array('post_tag');
    return $defaults;
    add_filter( 'arconix_faq_defaults', 'my_faq_defaults' );

I really don’t know exactly why Yurix’ code did not work, it looks like it should have (another reason I gave it a ‘helpful’ vote), but I assume that it has to do with how the plugin’s registers its CPT, using a variable called $defaults to contain all of its arguments, where ‘taxonomies’ was not mentioned (since it also sets up its own custom taxonomy)… I just added ‘taxonomies’ to $defaults……

Trisha 1 week 2023-03-15T14:48:57-05:00 0 Answers 0 views 0

Leave an answer