I need to do a get_posts() to fetch a list of "product" type posts, but when I do it on edit.php?post_type=mycustompost it returns empty. If I just simply do the same function but on edit.php (posts index page) it returns properly.
add_action('admin_head', 'custom_admin_head');
function custom_admin_head() {
$args = array(
'post_type' => 'product',
'posts_per_page' => 30,
);
$products = get_posts($args);
In this example
on edit.php?post_type=mycustompost… $products is empty
on edit.php… $products has 30 entries
How do I get it to return all 30 entries on the custom post type edit.php in wp-admin?