Is it possible to limit a CPT to just one? What I'd like to accomplish is creating a CPT called "Home". It will manage any and all elements on the home page. I want to program it so when the user clicks on the "Manage Home Page" link they will go straight to the edit post screen. They will skip over the "All Post" screen. Does anyone think this is even possible?

Or maybe someone has an idea to accomplish this goal a completely different?

  • 1
    Any reason you can't just use the front page option? Why go through the trouble of creating a custom type just for the home page, isn't that overcomplicating the task?
    – t31os
    Aug 19, 2011 at 12:46
  • I think it is. But my client is far too confused on how the home page works. See right now I have a page "Home", I have 3 posts "Home Content Box 1", "Home Content Box 2", "Home Content Box 3" and I widgetized an area on the top so the client can manage an area on the top of the home page for like is phone number, address, Call To Action imgs. so its just a little over whelming for him. Aug 19, 2011 at 12:53
  • I'm not sure i see how making that item a custom post type is going to avoid confusion where it appears to exist already, wouldn't simply creating an edit link on the home page partially address the issue? (you mentioned wanting to do that in your question). I'm just not sure i see how making this a custom type is going to make it any less confusing as you're already mixing posts in with a page, i'd have thought that's confusing enough already(no offense intended, offering an honest opinion).
    – t31os
    Aug 19, 2011 at 13:03
  • Or if you really want to go this route, then i'd suggest turning all those content areas into a single post type(less confusing than a mixture of posts and pages), and give them a name that represents what they do... eg. "Home Content" or something just as obvious. You could list each of the items with an edit link frontside that would link directly to the given item in the editor using edit_post_link (should work for any post type).
    – t31os
    Aug 19, 2011 at 13:12
  • first off, I promise I take no offense from anyone who is trying to help me. Secondly, your right i skipped some valuable info. Once i have the "home page" CPT I'm going to add meta boxes to it. probably like 4 wysiwyg's several image uploaders, textarea boxes, etc etc. I envsion a single admin menu page that has all the necessary input fields to manage the entire front end Home page. I hope this makes more sense? Aug 19, 2011 at 13:13

5 Answers 5


I would suggest creating a Theme Options page for this purpose.


add_options_page() in Codex.

Or is there anything special in the post edit screen that you want to use that would be hard to get into the Theme Options page?

  • I thought about going down this route. I want to stay as close to WP standards, so I don't want to save all this data to the options table. Aug 19, 2011 at 12:55
  • 1
    Whether you save it in the options table or in the posts table, you're saving it in the DB. Stick with a theme options page and keep things cleaner. Having a one-time-use CPT is more of a deviation from "WP standards" than anything else.
    – EAMann
    Apr 5, 2012 at 18:33

You want this because your client is confused, and setting a page to the homepage will not do.

But your solution is a can of worms waiting to explode in your face, so instead I have a much better solution!

Use the home.php template

In WordPress by default home.php is used as the homepage. If it is not found, front-page.php is used, and if that isn't found it uses index.php

So create home.php, put your homepage code in there, and then add a settings page with WYSIWYG editors and image uploaders for the various pieces of content. You can even link directly to the settings page from the frontend if logged in to the site.

If your client is still confused, use screensteps to show them how. Chances are your client is only confused because they haven't invested any time to read instructions or figure it out.

The added bonus of this is it doesn't leave any confusing steps like clicking on the listings and finding a single post available, and an 'add new home page' button that does nothing but generate warnings and permission denied messages.


May be this plugin could help you:

Author's site

WordPress plugin

  • those look close,but neither one address the issue of "skipping" over the "All Post" screen. Aug 19, 2011 at 12:57

Steve, my understanding is that you want:

  1. a custom post type with no All Posts sub menu
  2. you just want 'Edit Home Page' link to appear under Posts submenu?
  3. And you don't want your users to add more then 1 post for that particular post type.

The code below will tweak the WordPress Admin to do the above:

Note users can still add the post to custom post type using wp_insert_post

 * Plugin Name: Home Page CPT

class WPSE_26330_Homepage_CPT {

    function __construct() {

        // add the default homepage on plugin activation
        register_activation_hook( __FILE__, array( &$this, 'add_home_page_post' ) );

        // register the homepage post type
        add_action( 'init', array( &$this, 'register_homepage_cpt' ) );

        // add the menu link
        add_action( 'admin_menu', array( &$this, 'edit_homepage_link' ) );

    function edit_homepage_link() {
        global $submenu, $pagenow;

        // query the homepage posts
        $homepage = new WP_Query( 'post_type=homepage' );

        // if its new post page and we have homepage
        if ( $pagenow == 'post-new.php' && $homepage->have_posts() ) {
            wp_die('You cant add more then one homepage');

        // if we have homepage post, show the edit link else the add homepage link
        if ( $homepage->have_posts() ) {
            $link = get_edit_post_link( get_the_ID(), 'return' );
            $title = 'Edit Home Page';
        } else {
            // in case if the user has deleted the default post
            $link = get_bloginfo( 'url' ). '/wp-admin/post-new.php?post_type=homepage';
            $title = 'Add Home Page';
        $submenu['edit.php'] = array( array( $title, 'manage_options', $link ) ) + $submenu['edit.php'];

    function register_homepage_cpt() {
        $args = array( 
            'label' => 'homepage',
            'description' => 'Home Page post type',
            'public' => true,
            'show_in_menu' => false
        register_post_type( 'homepage', $args );

    function add_home_page_post() {
        // on activation first regsiter the post type

        // add the first and only post
        $post_data = array(
            'post_title' => 'Home Page',
            'post_type' => 'homepage',
            'post_statue' => 'publish',
            'post_author' => 1
        wp_insert_post( $post_data );


$GLOBALS['wpse_homepage_cpt'] = new WPSE_26330_Homepage_CPT;

I've actually done something very similar to this. I used a few different things in conjunction, and it all worked very well for my (easily confused) client.

Basically, I started with a page called "home". Then, using Advanced Custom Fields, I created the various fields I wanted the client to be able to control - two WYSIWYG fields, several image fields, a few link fields, you get the idea. Then, when setting up the rules for that ACF type, I hid the main 'content' area on the edit page. I made sure to add clear and concise rules for each content area to avoid confusion, so they would know exactly what they could and couldn't do in each field.

So, when the client clicks "edit page" in the WordPress menu, they're presented with the Edit Post page for "Home", with all the areas they control laid out neatly.

Then, I set up the home.php template to call the field output in the proper places. There's several nice tutorials and code snippes on the ACF main site.

It made a VERY happy client, and took a lot of future frustrating maintenance off my plate.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.