Last active
October 13, 2024 06:08
-
-
Save emre-edu-tech/555ecb65923279750281c15a0f1bf220 to your computer and use it in GitHub Desktop.
Checking the custom post type mapped capabilities while in development stage.
This file contains 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 characters
<?php | |
// FOR DEVELOPMENT PURPOSES, create a submenu page that displays the capabilities of | |
// Custom Post Type which is called Topic and this page is only available to ADMINS | |
add_action('admin_menu', 'mpons_forum_submenu'); | |
function mpons_forum_submenu() { | |
add_submenu_page( | |
'tools.php', | |
__('Media Pons Topic CPT', 'media-pons-forum'), | |
__('Media Pons Topic CPT', 'media-pons-forum'), | |
'manage_options', | |
'media-pons-topic-cpt', | |
'media_pons_render_topic_cpt' | |
); | |
} | |
function media_pons_render_topic_cpt() { | |
$topic = $GLOBALS['wp_post_types']['topic']; | |
?> | |
<div class="wrap" id="media-pons-cpt-admin"> | |
<h1>Topic</h1> | |
<pre><?php print_r(['capability_type' => $topic->capability_type]) ?></pre> | |
<pre><?php print_r(['map_meta_cap' => $topic->map_meta_cap]) ?></pre> | |
<pre><?php print_r(['cap' => $topic->cap]) ?></pre> | |
<pre><?php print_r($topic) ?></pre> | |
</div> | |
<?php | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment