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:
https://website.com/wp-admin/edit.php?post_type=org_post_type&page=edit-org&id=1998
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);
var_dump($data_post);
it return `NULL