• Resolved studio1337

    (@studio1337)


    I’m having some issues with disabling based on post type. We need Gutenberg active for posts and a custom post type, recipes, with the remaining post types having Gutenberg disabled. Under ‘Disable for Post Types’ both posts and recipes are unchecked, but while posts are correctly displaying Gutenberg, recipes posts still show the classic editor.

    The recipes CPT was created after installing Disable Gutenberg. Just in case, I tried checking, saving, unchecking and resaving, to see if this would allow Gutenberg to run on recipes, but this didn’t solve the problem. I’m not sure what else to try. Are there any known issues with this plug-in and custom post types?

    This plug-in has been a godsend for a number of recent projects – thank you for this contribution to the WordPress community!

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Jeff Starr

    (@specialk)

    Hi @studio1337,

    Glad to help. I’m not aware of any issues with CPTs. Are you noticing any related errors in the site error/debug log(s)?

    Thread Starter studio1337

    (@studio1337)

    Hi Jeff,

    Good question – I checked the error log and nothing registered there. I also tried turning on WordPress debugging, tried saving settings and viewing a recipe post, and while the classic editor is showing, nothing was generated in log files.

    I’m happy to share temporary login details privately if you’d like to see the error in action, or I can take screen shots to confirm the settings and results.

    Thanks for your help!
    Paul

    Plugin Author Jeff Starr

    (@specialk)

    Hi Paul,

    The best way I can help is to recreate the issue locally on default WordPress. That way I can see exactly what is happening and try to resolve any issue. To help with this, please provide clear/simple steps to replicate the issue. For example, something like this:

    1) Install default WP
    2) Install/activate DG plugin
    3) Enable such and such settings
    4) Visit CPT or whatever
    5) Do something etc.

    That way I can follow along and try to help asap. Let me know if any questions about this.

    Thread Starter studio1337

    (@studio1337)

    Hi Jeff – I’ll give this a try, but it may not be as easy as it sounds.

    1) Install default WP

    2) Install plug-ins. Here’s a full list, but likely only a couple might cross paths with DG functionally.

    Advanced Custom Fields PRO
    Disable Gutenberg
    Divi Builder
    Duplicate Post
    Elegant Themes Updater
    Gravity Forms
    Post Type Switcher
    Smush
    WP-PageNavi
    Yoast SEO
    Zip Recipes

    3) Create CPT for Recipes. Here’s what I have in the functions folder (some of these settings are redundant because they’re default, but I don’t think that shouldn’t impact anything):

    [code]add_action( 'init', 'create_custom_taxonomies', 0 );
    function create_custom_taxonomies() {
    // RECIPES
    $labels = array(
    'name' => _x( 'Recipe Categories', 'taxonomy general name' ),
    'singular_name' => _x( 'Recipe Category', 'taxonomy singular name' ),
    'search_items' => __( 'Search Recipe Categories' ),
    'all_items' => __( 'All Recipe Categories' ),
    'parent_item' => __( 'Parent Recipe Category' ),
    'parent_item_colon' => __( 'Parent Recipe Category:' ),
    'edit_item' => __( 'Edit Recipe Category' ),
    'update_item' => __( 'Update Recipe Category' ),
    'add_new_item' => __( 'Add New Recipe Category' ),
    'new_item_name' => __( 'New Recipe Category Name' ),
    'menu_name' => __( 'Recipe Category' ),
    );
    $args = array(
    'public' => true,
    'hierarchical' => true,
    'labels' => $labels,
    'show_ui' => true,
    'show_admin_column' => true,
    'query_var' => true,
    );
    register_taxonomy( 'recipe-categories', array( 'recipes' ), $args );
    }

    add_action( 'init', 'create_post_type' );
    function create_post_type() {
    // REGISTER NEW POST TYPE: RECIPE POSTS
    register_post_type( 'recipes',
    array(
    'labels' => array(
    'name' => __( 'Recipe Posts' ),
    'singular_name' => __( 'Recipe Post' )
    ),
    'public' => true,
    'show_ui' => true,
    'has_archive' => true,
    'exclude_from_search' => false,
    )
    );
    }[/code]

    4) Move a handful of posts from the blog (Posts) to recipes (Recipe Posts).

    5) Make sure ‘Post Type = recipes’ is unchecked in DG settings (it was unchecked by default after I created the new post type).

    6) Check a recipe post to see whether Gutenberg is enabled.

    Divi Builder is turned on for this post type (we’re carrying over old posts from a previous build, and needed to have this installed), and it similarly determines whether particular editing functions are available for a post type. Maybe there’s a conflict?

    Also, Zip Recipes creates a hidden CPT, but this doesn’t appear to generate a post-type. I looked through the plug-in to see if I could find a post type registered, and I wasn’t able to find a register_post_type (I checked plug-in-root files manually, and ran grep -r register_post_type * to see if the command was present anywhere in the plug-in). So I’m pretty certain that DG setting is for the CPT I created manually. Also, the CPT slug matches the one I entered when I preview the post.

    I don’t know if this whole process will bear much; maybe it helps just having the list of plug-ins and CPT code? We know DG is affecting the post type; otherwise, the classic editor would not display. So it’s not ignoring it. It’s definitely affecting it. It’s just a matter of making it *not* affect it…:)

    Thread Starter studio1337

    (@studio1337)

    Sorry – I botched the markdown. My head was in shortcodes, and I used BBCode. I thought I would be able to edit my post, but apparently only the first post can be edited for a limited time.

    Plugin Author Jeff Starr

    (@specialk)

    Allow me to clarify and provide some context. In general plugins are developed on default WP setup, using the default theme, default settings, and no other plugins. Unless there is an issue with a particular plugin or theme, of course. To try and develop plugins with every combination of over 30,000 plugins would be impossible at best.

    So with that in mind, I definitely want to help resolve any issue, but will need clear steps on *default WordPress install* in order to continue looking at this. That means you will need to do some basic troubleshooting of your plugins and theme, etc. Such that the steps to replicate consist of only DG running on default WP setup.

    And/or, if you discover, during your troubleshooting session, that there is some specific plugin that is causing problems, let me know which one and I will take a look.

    Thread Starter studio1337

    (@studio1337)

    That makes sense. I will look for a conflict and let you know what I find.

    Thread Starter studio1337

    (@studio1337)

    Hi Jeff,

    Here’s what I did. I switched the theme to TwentyTwenty and turned off all plug-ins with the exception of Disable Gutenberg. Then I added the CPT markup and checked settings. DG is turned off for posts and recipes. Posts are showing Gutenberg as expected, but recipes is still showing the classic editor. Is there a custom post type setting that needs to be in place in order for Gutenberg to interact with it properly?

    Here’s the code I inserted – let’s try marking it up properly this time ??

    add_action( 'init', 'create_custom_taxonomies', 0 );
    function create_custom_taxonomies() {
    	// RECIPES
    	$labels = array(
    		'name'              => _x( 'Recipe Categories', 'taxonomy general name' ),
    		'singular_name'     => _x( 'Recipe Category', 'taxonomy singular name' ),
    		'search_items'      => __( 'Search Recipe Categories' ),
    		'all_items'         => __( 'All Recipe Categories' ),
    		'parent_item'       => __( 'Parent Recipe Category' ),
    		'parent_item_colon' => __( 'Parent Recipe Category:' ),
    		'edit_item'         => __( 'Edit Recipe Category' ),
    		'update_item'       => __( 'Update Recipe Category' ),
    		'add_new_item'      => __( 'Add New Recipe Category' ),
    		'new_item_name'     => __( 'New Recipe Category Name' ),
    		'menu_name'         => __( 'Recipe Category' ),
    	);
    	$args = array(
    		'public'			=> true,
    		'hierarchical'      => true,
    		'labels'            => $labels,
    		'show_ui'           => true,
    		'show_admin_column' => true,
    		'query_var'         => true,
    	);
    	register_taxonomy( 'recipe-categories', array( 'recipes' ), $args );
    }
    
    add_action( 'init', 'create_post_type' );
    function create_post_type() {
    	// REGISTER NEW POST TYPE: RECIPRE POSTS
    	register_post_type( 'recipes',
    		array(
    			'labels' => array(
    				'name' => __( 'Recipe Posts' ),
    				'singular_name' => __( 'Recipe Post' )
    			),
    		'public' => true,
    		'show_ui' => true,
    		'has_archive' => true,
    		'exclude_from_search' => false,
    		)
    	);
    }

    Thanks again for your help!

    Plugin Author Jeff Starr

    (@specialk)

    Thanks, I will investigate and try to resolve any issues for the next plugin update. In the meantime, please let me know if any related infos, etc.

    Plugin Author Jeff Starr

    (@specialk)

    Hi Paul,

    I spent some time investigating, turns out the CPT you are using is missing a couple of parameters:

    'show_in_rest' => true,
    'supports'     => array('editor')

    Add those to the CPT function and all should be well.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Can’t Leave Gutenberg Active on Custom Post Types’ is closed to new replies.