Created
June 1, 2021 09:37
-
-
Save teknikqa/c656bb96809e4bfde3843975b6fd2457 to your computer and use it in GitHub Desktop.
Revisions
-
teknikqa created this gist
Jun 1, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,49 @@ <?php /** * WordPress Theme constants and setup functions * * @package WPCustomTheme */ /* * When using WordPress as a CMS the Posts content type might not be useful or * required on some sites. While WordPress provides a way to deregister custom * post type, the default Post type in WordPress cannot be dergegistered or * disabled. It can only be hidden. A few caveats: * * New posts can still be created using the direct link. * * Existing posts are not affected and will continue to load publicly. * * Editing exisiting posts will not be possible. * * Multisite will still show a menu item to create new posts. */ add_action( 'wp_dashboard_setup', 'remove_draft_widget', 999 ); add_filter( 'register_post_type_args', 'remove_default_post_type', 0, 2 ); /** * Remove Quick Draft Dashboard Widget */ function remove_draft_widget() { remove_meta_box( 'dashboard_quick_press', 'dashboard', 'side' ); } /** * Remove access to the Post type as well as hide it from the menu * * @param array $args The array of arguments for registering a post type. * @param string $post_type The post type. * @return array */ function remove_default_post_type( $args, $post_type ) { if ( 'post' === $post_type ) { $args['public'] = false; $args['show_ui'] = false; $args['show_in_menu'] = false; $args['show_in_admin_bar'] = false; $args['show_in_nav_menus'] = false; $args['can_export'] = false; $args['has_archive'] = false; $args['exclude_from_search'] = true; $args['publicly_queryable'] = false; $args['show_in_rest'] = false; } return $args; }