0

I have a site where the posts are coming up in the classic editor, but should be in the block editor. The site is up to date with WordPress 5.2.3. The theme is based on TwentyTwelve.

No "Classic Editor" plug-in is activated, so there's no reason why Classic is being used in Posts. As a result, all post types come up in the Classic editor. The client wants to use blocks for posts.

Any ideas? There are five post types in play here. I used a code to try and force all the post types to work with Gutenberg, but no results.

// Enable Gutenberg for all post types
function shapeSpace_enable_gutenberg_post_type($can_edit, $post) {

    if (empty($post->ID)) return $can_edit;

    if ('any' === $post_type) return true;

    return $can_edit;

}

// Enable Gutenberg for WP < 5.0 beta
add_filter('gutenberg_can_edit_post_type', 'shapeSpace_enable_gutenberg_post_type', 10, 2);

// Enable Gutenberg for WordPress >= 5.0
add_filter('use_block_editor_for_post_type', 'shapeSpace_enable_gutenberg_post_type', 10, 2);

Cache cleared and everything.

Site is https://moneysmartfamily.com

0

There are code errors... any is not a post type and you are setting the 2nd function argument to $post instead of $post_type so it is undefined anyway.

Also $post is not provided in this context, there is a separate filter for filtering by specific posts (gutenberg_can_edit_post / use_block_editor_for_post)

If you want to force all post types to use Gutenberg you don't need to check any conditions anyway, you can just return true.

function shapeSpace_enable_gutenberg_post_type($can_edit, $post_type) {
    return true;
}

If you find the need to use a combination of Classic and Block Editor, here's a plugin solution I wrote a little while back for that purpose: https://wordpress.org/plugins/guten-free-options/

  • Thanks for your response. Interesting. I used "any" because on a querying solution for this site, I used that to set up query args as such: $args = array( 'post_type' => 'any', 'category_name' => 'budget',= ); and it was okay. So obviously I assumed "any" could be used elsewhere like a wildcard. – David Borrink Oct 10 '19 at 18:58
  • I tried your code suggestion and that didn't help so there is something else interfering with the site to force Classic editor for posts. I'll try your plug-in and see if that helps. GREAT plug-in name! LOL – David Borrink Oct 10 '19 at 19:12
  • I tried the plug-in and set the default editor to Blocks. Impressive plug-in! Nice interface and choices. You thought of everything. I see a lot of inherited choices. Unfortunately new posts come up in Classic, and existing posts had a blank screen. So next I'll check for plug-in conflicts. – David Borrink Oct 10 '19 at 22:21
  • hmmm let me know how it goes I haven't done any thorough testing of it lately, I don't actually use Gutenberg much and keep up with all the changes, just took up the challenge to try to make something as robust as I could to help with transitioning since it was set as the default editor for existing installs instead of just fresh ones. (Overall I'm a fan of backwards compatibility more than most.) – majick Oct 11 '19 at 16:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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