Open t-hamano opened 1 year ago
Related to #53137
Currently, to determine if a activetheme is a block-based theme, we use the Block Editor API as follows:
import { store as blockEditorStore } from '@wordpress/block-editor'; const isBlockBasedTheme = useSelect( ( select ) => { return select( blockEditorStore ).getSettings().__unstableIsBlockBasedTheme; }, [] );
However, if the current page does not load a block editor, this API returns undefined.
In order to accurately determine if it is a block-based theme, it would be good to replace it with a core data API, as suggested in this comment.
import { store as coreStore } from '@wordpress/core-data'; const isBlockBasedTheme = useSelect( ( select ) => { return select( coreStore ).getCurrentTheme().is_block_theme; }, [] );
I am taking this issue 😄
Thanks, @HILAYTRIVEDI.
The change needs to happen in WP Core and WP_REST_Themes_Controller.
WP_REST_Themes_Controller
@t-hamano, I think this is probably not a "Good First Issue" task.
Related to #53137
What problem does this address?
Currently, to determine if a activetheme is a block-based theme, we use the Block Editor API as follows:
However, if the current page does not load a block editor, this API returns undefined.
What is your proposed solution?
In order to accurately determine if it is a block-based theme, it would be good to replace it with a core data API, as suggested in this comment.