Support

Account

Home Forums Gutenberg Limit blocks/block_categories to front page?

Unread

Limit blocks/block_categories to front page?

  • Is there anyway to limit blocks and/or block categories to the front_page or page templates perhaps? The below doesn’t work…

    function home_block_categories( $categories ) {
    		
    
    			if ( is_front_page()) {
    				return $categories;
    			}
    			return array_merge(
    				$categories,
    				array(
    					array(
    						'slug' => 'cold_blood_home_cat',
    						'title' => __( 'Home Page', 'my-plugin' ),
    						'icon'  => 'wordpress',
    					),
    				)
    			);
    		
    	}
    
    add_filter( 'block_categories', 'home_block_categories', 10, 2 );
Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.