get_posts() returns empty, called inside of another query?

Viewed 35

I need to be able to use get_posts() inside of a restrict_manage_posts:

<?php
add_action('restrict_manage_posts', 'my_manage_posts_fn');

function my_manage_posts_fn()
{
    $type = 'my_custom_post';

    if (isset($_GET['post_type']) && $_GET['post_type'] == $type) {

        $args = array('post_type' => 'products', 'posts_per_page' => 100);
        $products = get_posts($args);
        // $products RETURNS EMPTY, WHY?
        // Also, I notice that if I don't set post_type to 'products', it
        // will return the query for my_custom_post

    }
}

Thanks in advance!

0 Answers
Related