Add Custom Post Type into menu editor


When you create custom post type and want to show that post in wordpress menu navigation then add argument in defination.

Add ‘show_in_nav_menus’ argument and set its value ‘true’

Following code shows how to add cpt in menu navigation.
Example Code :

add_action( 'init', 'custom_posttype' );
function custom_posttype() {
	register_post_type( 'custom_post',
		array(
			'labels' => array(
				'name' => __( 'Computers' ),
				'singular_name' => __( 'Computer' )
			),
			'public' => true,
			'has_archive' => true,
			'rewrite' => array('slug' => 'computers'),
			'show_in_nav_menus' => true,
		)
	);
}
Advertisements

5 thoughts on “Add Custom Post Type into menu editor”

  1. Hi
    Your content on Add Custom Post Type into menu editor is great and also well considered.
    I will definitely come back in order to review your article content..

  2. What’s Happening i’m new to this, I stumbled upon this I have found It absolutely helpful and it has aided me out loads. I am hoping to give a contribution & help different customers like its aided me. Good job.

  3. Hi there would you mind letting me know which webhost you’re utilizing? I’ve loaded your blog in 3 completely different internet browsers and I must say this blog loads a lot faster then most. Can you recommend a good hosting provider at a reasonable price? Thank you, I appreciate it!

    1. Hi Elizabeth, I used this site on wordpress.com as subdomain site. It is depends site speed on multiple factors like how many plugins are used in site, how many js files used , images , site bandwidth etc. which affect site loading. So i suggest you to first optimize your site. You can also use cache plugins like WP Super Cache or W3 Total Cache etc. which help you to optimization. Hope this will helpful for you. Thanks

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s