• Resolved lovebexa

    (@lovebexa)


    Hi,

    I have a custom post-type called Listings. It’s not “Page” nor “Blog” it’s called “Listings” and is separate with separate categories. For my directory.

    For my “listing form” I added taxonomies options for Category and Tags but it shows the categories from the Blog. It wont show the Listings categories in the drop down menu and when a user submits the form the Tags don’t link up either.

    How do I connect them?

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Hello @lovebexa,

    Let me know if you are using any third-party plugin for building the custom post type and custom taxonomy.

    Regards,

    Thread Starter lovebexa

    (@lovebexa)

    Hey @611shabnam !! Yes it’s called “QK Listing Tools”

    @lovebexa

    If I create CPT Title and Content is submitted but Categories and Tags are ignored. Those fields are empty.

    I am using function of wordpress, no prlugin required.

    • This reply was modified 5 years, 1 month ago by hellojesse.
    // CPT portfolio
    
    add_action('init','create_post_type');
    add_action('init','create_taxonomies');
    
    	function create_post_type() {
    		$labels = array(
    			'name'               => 'Portfolios',
    			'singular_name'      => 'Portfolio',
    			'menu_name'          => 'Portfolios',
    			'name_admin_bar'     => 'Portfolio',
    			'add_new'            => 'Add New',
    			'add_new_item'       => 'Add New Portfolio',
    			'new_item'           => 'New Portfolio',
    			'edit_item'          => 'Edit Portfolio',
    			'view_item'          => 'View Portfolio',
    			'all_items'          => 'All Portfolios',
    			'search_items'       => 'Search Portfolios',
    			'parent_item_colon'  => 'Parent Portfolio',
    			'not_found'          => 'No Portfolios Found',
    			'not_found_in_trash' => 'No Portfolios Found in Trash'
    		);
    
    		$args = array(
    			'labels'              => $labels,
    			'public'              => true,
    			'exclude_from_search' => false,
    			'publicly_queryable'  => true,
    			'show_ui'             => true,
    			'show_in_nav_menus'   => true,
    			'show_in_menu'        => true,
    			'show_in_admin_bar'   => true,
    			'menu_position'       => 80,
    			'menu_icon'           => 'dashicons-format-gallery',
    			'capability_type'     => 'post',
    			'hierarchical'        => false,
    			'supports'            => array( 'title', 'editor', 'author', 'thumbnail', 'comments', 'custom-fields' ),
    			'has_archive'         => true,
    			'rewrite'             => array( 'slug' => 'portfolio' ),
    			'query_var'           => true
    		);
    
    		register_post_type( 'oi_portfolio', $args );
    	}
    
    	function create_taxonomies() {
    
    		// Add new taxonomy, make it hierarchical (like categories)
    		$labels = array(
    			'name'              => 'Portfolio Categories',
    			'singular_name'     => 'Portfolio Category',
    			'search_items'      => 'Search Portfolio Categories',
    			'all_items'         => 'All Portfolio Categories',
    			'parent_item'       => 'Parent Portfolio Category',
    			'parent_item_colon' => 'Parent Portfolio Category:',
    			'edit_item'         => 'Edit Portfolio Category',
    			'update_item'       => 'Update Portfolio Category',
    			'add_new_item'      => 'Add New Portfolio Category',
    			'new_item_name'     => 'New Portfolio Category Name',
    			'menu_name'         => 'Portfolio Categories',
    		);
    
    		$args = array(
    			'hierarchical'      => true,
    			'labels'            => $labels,
    			'show_ui'           => true,
    			'show_admin_column' => true,
    			'query_var'         => true,
    			'rewrite'           => array( 'slug' => 'portfolio_category' ),
    		);
    
            register_taxonomy('oi_portfolio_categories',array('oi_portfolio'),$args);
    
    		// Add new taxonomy, NOT hierarchical (like tags)
    		$labels = array(
    			'name'                       => 'Portfolio Tags',
    			'singular_name'              => 'Portfolio Tag',
    			'search_items'               => 'Portfolio Tags',
    			'popular_items'              => 'Popular Portfolio Tags',
    			'all_items'                  => 'All Portfolio Tags',
    			'parent_item'                => null,
    			'parent_item_colon'          => null,
    			'edit_item'                  => 'Edit Portfolio Tag',
    			'update_item'                => 'Update Portfolio Tag',
    			'add_new_item'               => 'Add New Portfolio Tag',
    			'new_item_name'              => 'New Portfolio Tag Name',
    			'separate_items_with_commas' => 'Separate Portfolio Tags with commas',
    			'add_or_remove_items'        => 'Add or remove Portfolio Tags',
    			'choose_from_most_used'      => 'Choose from most used Portfolio Tags',
    			'not_found'                  => 'No Portfolio Tags found',
    			'menu_name'                  => 'Portfolio Tags',
    		);
    
    		$args = array(
    			'hierarchical'          => false,
    			'labels'                => $labels,
    			'show_ui'               => true,
    			'show_admin_column'     => true,
    			'update_count_callback' => '_update_post_term_count',
    			'query_var'             => true,
    			'rewrite'               => array( 'slug' => 'portfolio_tag' ),
    		);
    
            register_taxonomy('oi_portfolio_tags','oi_portfolio',$args);
    
    }

    Hello @lovebexa,

    Probably I need to check the issue thoroughly to spot the reason of it.

    It would be great if you can contact us so that we can help you more elaborately.

    Regards,

    hellojesse

    (@egyptimhotep)

    @611shabnam I can confirm that there is some bug in linking CPT and form. It doesn’t post tags and categories. Above I sent my Custom post type function.

    I believe it is bug.

    hellojesse

    (@egyptimhotep)

    @lovebexa Did you figure out how to fix this linking issue?

    Hello @egyptimhotep,

    I have reviewed your code and have replied to you on the other ticket you created on the forum. Please follow that.

    Regards,

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Custon Taxonomy not linking up’ is closed to new replies.