• Resolved JohnDBB

    (@johndbb)


    Hello,

    I have this code that doesn’t seem to work with WordPress 5.5, but I cannot find why… How can I override a core block since WordPress 5.5, please?

    function em_gallery_render( $attributes, $content ) {
    
    	if ( isset( $attributes ) && is_array( $attributes ) && isset( $attributes['ids'] ) ) {
    		$ids = implode( ",", $attributes['ids'] );;
    
    		return do_shortcode( '[gallery size="full" ids="' . $ids . '"]' );
    	}
    }
    
    function em_register_gallery() {
    	register_block_type( 'core/gallery', array(
    		'render_callback' => 'em_gallery_render',
    	) );
    }
    
    add_action( 'init', 'em_register_gallery' );
    • This topic was modified 4 years, 5 months ago by JohnDBB.
    • This topic was modified 4 years, 5 months ago by JohnDBB.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Override core block in WordPress 5.5’ is closed to new replies.