Coder Social home page Coder Social logo

Deactivates Gutenberg editor on custom post types not explicitly returning true from function hooked to `post_type_supports_convert_to_blocks` filter about convert-to-blocks HOT 2 CLOSED

10up avatar 10up commented on June 8, 2024
Deactivates Gutenberg editor on custom post types not explicitly returning true from function hooked to `post_type_supports_convert_to_blocks` filter

from convert-to-blocks.

Comments (2)

dsawardekar avatar dsawardekar commented on June 8, 2024 1

@adriantoll Thanks for reporting this issue. I've identified this call as the cause of the issue,

if ( ! $this->container->post_supports_convert_to_blocks( $post ) ) {

If the post_type_supports hook return is false it exits early. We'll add a new hook to the plugin to override this behavior. The if conditions will compute the return value and use a filter like below before returning from the enable_block_editor function. Something on the lines of,

return apply_filters( 'convert_to_blocks_enable_block_editor', $result );

A workaround you can use right now is to override this behavior manually by adding a higher priority use_block_editor_for_post action hook. And then returning true for the respective post type.

cc @jeffpaul

from convert-to-blocks.

adriantoll avatar adriantoll commented on June 8, 2024

Thanks for the update @dsawardekar. I'm actually happy for this to run on all post types that use the block editor, so for now I've just manually listed those in the post_type_supports_convert_to_blocks hook.

from convert-to-blocks.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.