Inside a custom plugin and using add_submenu_page() for custom post type I want to display one post. As the other post_type I use get_posts($the_id, $arr_params) to get information about it, except in this case where it return NULL. The corresponding ID exist in database .

the creation of this add_submenu_page() :

add_submenu_page( null , 'Modify Organization', 'Modify Organization','manage_options', 'edit-org','atv_edit_org');

The url of this custom post page is:


So, using get_posts():

Update = get_post() not get_posts().

global $pagenow;
if ( $pagenow == 'edit.php' && $_GET['page'] == 'edit-org'):
//include_once(ABSPATH . 'wp-includes/pluggable.php');

$post_id = $_GET['id'];
$args_org_post = array('post_type' => 'org_post_type', 'post_status' => 'draft');
$data_post = get_post($post_id, $args_org_post);

it return `NULL

  • 1
    You’re using get_post incorrectly. It doesn’t accept an array or arguments. get_posts does, but it doesn’t accept an ID. You seem to have confused the two. Nov 20, 2023 at 2:14
  • Thanks, In my research I confused get_post() and get_posts() parameters.
    – imagIne
    Nov 20, 2023 at 9:30


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.