The popular open-source contract for web professionals by Stuff & Nonsense
- Originally published: 23rd December 2008
- Revised date: March 15th 2016
- Original post
| function custom_add_interface_to_wp_block( $args, $post_type ) { | |
| if ( 'wp_block' === $post_type ) { | |
| $args['supports'] = array( 'title, 'editor' ); | |
| $args['show_in_rest'] = true; | |
| $args['show_in_menu'] = true; | |
| if ( strstr( $_SERVER['REQUEST_URI'], 'wp-admin/post-new.php' ) || strstr( $_SERVER['REQUEST_URI'], 'wp-admin/post.php' ) ) { | |
| $args['rest_controller_class'] = 'WP_REST_Posts_Controller'; | |
| } else { | |
| $args['rest_controller_class'] = 'WP_REST_Blocks_Controller'; |
| <?php | |
| /** | |
| * Commands to handle WordPress Widgets more in depth. | |
| * | |
| * Based on code from Chris Wiegman. Thanks, buddy. | |
| * | |
| * @author Matt Pritchett | |
| */ | |
| /** |