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

    (@pallisvans)

    Changed from categories to tags and it works now. I think the problem lies with the other plugin; Add Categories to Pages.

    • This reply was modified 5 years, 8 months ago by pallisvans.

    To add categories (and tags) to pages, I just add this to my functions.php and so far (to my knowledge) not conflicted with anything on some quite plugin-heavy sites ??

    // Add categories and tags to pages
    function add_taxonomies_to_pages() {
    	register_taxonomy_for_object_type( 'post_tag', 'page' );
    	register_taxonomy_for_object_type( 'category', 'page' );
    	}
    add_action( 'init', 'add_taxonomies_to_pages' );
    	if ( ! is_admin() ) {
    	add_action( 'pre_get_posts', 'category_and_tag_archives' );
    	}
    function category_and_tag_archives( $wp_query ) {
    	$my_post_array = array('post','page');
     
    	if ( $wp_query->get( 'category_name' ) || $wp_query->get( 'cat' ) )
    	$wp_query->set( 'post_type', $my_post_array );
     
    	if ( $wp_query->get( 'tag' ) )
    	$wp_query->set( 'post_type', $my_post_array );
    	}

    (On occasion I’ve found this really helpful in combo with LCP, which is why I’m posting here, though somewhat marginal relevance to this plugin.)

    Hope that’s helpful.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Not compatible with Add categories to pages plugin’ is closed to new replies.