Custom Press--adding custom post type throws error

I've installed Custom Press on a virtually fresh Wordpress MS site. The only other plugins on the site are WPMU DEV and Akismet. After selecting all of the options I want for my custom post type, when I click on "Add post type", I get this error at the top of the screen:

Notice: Undefined index: cf_columns in /home/qultshow/public_html/wp-content/plugins/custompress/core/content-types.php on line 234

Warning: Cannot modify header information - headers already sent by (output started at /home/qultshow/public_html/wp-content/plugins/custompress/core/content-types.php:234) in /home/qultshow/public_html/wp-includes/pluggable.php on line 876

The custom post type is created, but whenever I edit it, the same error is shown at the top of the page. Why does this error show up?

  • Arnold

    That's a Warning message, so you have your debug setting a bit high. Warnings and Notices are not normally shown in Wordpress.

    In order to see the menus you also have to have the capabilities . Go into your Post type and in Map Meta Capabilities makes sure it's set to true and in "Role Capabilities Settings" make sure that Administrator has all the checkboxes checked. Any other roles that need access need to be set here too.

  • Raevenne

    Hi Arnold, and thank you for responding here.

    I set the debug setting to false in wp_config. I'd been using this site for plugin development and obviously needed that to be set to true. I'm still wondering why it throws an error, and why it would be okay to essentially ignore it rather than program it so that there are no errors.

    In order to see the menus you also have to have the capabilities . Go into your Post type and in Map Meta Capabilities makes sure it's set to true and in "Role Capabilities Settings" make sure that Administrator has all the checkboxes checked. Any other roles that need access need to be set here too.

    The Map Meta Capabilities was already set to true. The Role Capabilites Settings look like the screen shot attached. There are no checkboxes for any of the roles.

  • Arnold

    Ah, Multisite, that's the problem. If you are defining at the Network level there are no roles. Roles are assigned to a user one Role per subsite. Network will not have other than superadmin.

    You can create custom types at the network level but remember they will be on EVERY subsite. If you only need them on a few subsites, do not network activate other than to set the Network settings. If you need to create and edit types on a subsite you need to check the "If you enable this option, sub-sites on your network will be able to define their own content types. If this option is not enabled ( default ) all sites on your network will be forced to use the network-wide content types defined by you, the Super Admin. " checkbox in Network > CustomPress > Settings

    Then you can create and edit at the subsite levels. You can uncheck it later if you want to lock the subsite settings. The menu will disappear on subsites but the custom types will still be usable by code.

  • Raevenne

    Hmmm, okay, I want the custom post type on every subsite, so I do want to create the post types at the Network level.

    When I go to the admin area on a subsite, I still don't see the custom post type as an option in the menu in the left column. If I've set everything up in the Network Admin section, why am I not seeing the custom post type in the admin menu at all? I don't see any options inside the CustomPress menus on the subsites to fix this issue.

    Also, are there MultiSite specific instructions somewhere for CustomPress, and I've just missed seeing them?

  • Raevenne

    Okay, I figured it out finally: you have to check this option:

    If you enable this option, all subsites will use and display the content types defined at the network level.

    to get the custom post types to show up for in the subsite admin menus. And lo and behold, the checkboxes in the Role Capabilities Settings box show up when you do that too.

    So thank you for your help Arnold. Still, did I miss some instructions somewhere that would have made this clear from the beginning? If so, I do apologize for needing help at all; if not, there should be step by step instructions for activating and setting up using Multi Site.

  • Arnold

    You still need to check the

    "If you enable this option, sub-sites on your network will be able to define their own content types. If this option is not enabled ( default ) all sites on your network will be forced to use the network-wide content types defined by you, the Super Admin. "

    and the "If you enable this option, all subsites will use and display the content types defined at the network level." checkbox at the network level.

    Then you'll have the role editor at the Network level. And they will appear in the subsites. It's only available if you check these two.

  • Raevenne

    You still need to check the

    "If you enable this option, sub-sites on your network will be able to define their own content types. If this option is not enabled ( default ) all sites on your network will be forced to use the network-wide content types defined by you, the Super Admin. "

    and the "If you enable this option, all subsites will use and display the content types defined at the network level." checkbox at the network level.

    Actually, I think I only want the second one checked. I don't want subsites to define their own content types (at least not for this particular project). So I think I need to leave the top choice unchecked and check the bottom one.

  • Raevenne

    This might help

    http://custompress.co/

    I looked at that before downloading the plugin, and I've looked at the Usage section on the plugin download page again just now to see if there was anything there that I just skipped over when I read it the first time. I think the first part on the Usage page about the two ways to use the plugin with Multi Site just didn't make any sense to me since I didn't have any experience with the plugin at all when I read it to begin with. After reading it again just now, it still seams geared toward people who do want the subsites to be able to create custom post types, so it isn't really clear what you should do if you don't want that functionality.

    Having said that, I realize that everyone reads and absorbs things differently, and what doesn't make sense to one person can be crystal clear to someone else.

    Thanks again for the help Arnold. I think I have it sorted now.

  • AlwynW

    I'm also experiencing a lot of issues all of the sudden. This was working just fine before.
    I don't think turning off debug can be called a valid solution Arnold. I believe the custompress code should just work without errors because as a developer I need that setting to be on.
    When I go to the lines that throw errors there is a lot of error checking missing and that's not ok.
    Sure saving a custom post type/taxonomy does work in the background but how is a user to know if a notice is shown and the view doesn't update?

    One example (content-types.php, line 1038):

    $invalid = true;

    foreach($value as $item){
    $invalid = (!empty($item)) ? $false : $invalid;
    }

    $false isn't even defined anywhere so it's quite normal that a notice is shown.

    Another (content-types.php line 484):

    $cap = $wp_post_types[$post_type]->capability_type;

    Here it's not even checked if $wp_post_types[$post_type] even exists, again another error.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.