WordPress.org

Forums

Taxonomies for specific pages (2 posts)

  1. devoninternational
    Member
    Posted 2 years ago #

    Hello the below code registers a taxonomy and causes the meta box to show only when in that taxonomy in the wordpress admin.

    My question is how to register a new taxonomy but have it only display for the children of a certain parent page. So if I had product type A, I would want all those child pages(products) to have the taxonomy and a meta box.

    The line that has

    'landing_pages',

    places this in my custom post type in the admin.

    Another question is there a way to set an array so I can target post, page and a CPT? Curios how flexible the wordpress taxonomies are.

    Let me know if I am not being clear.

    /*  Landing Pages Categories Taxonomy  */
    add_action( 'init', 'landing_pages_cats' );
    function landing_pages_cats() { // Landing Pages Categories
    	register_taxonomy(
    		'landingpagescats',
    		'landing_pages',
    		array('label' => __( 'Landing Pages Categories' ), 'sort' => true, 'args' => array( 'orderby' => 'term_order' ), 'rewrite' => array( 'slug' => 'category-news-room' ), 'hierarchical' => true )
    	);
    }
  2. devoninternational
    Member
    Posted 2 years ago #

    Still trying to figure this out... is there another section on the forums that I could post this question or am I in the right area?

Topic Closed

This topic has been closed to new replies.

About this Topic