I need to add some custom submenu links to the Posts menu in WordPress admin so content managers can click on a link and get a list of posts from today, yesterday or this month. The default date filter in the WordPress back end filters posts by month only. When you select that filter it produces a URL like

http:// ..... /wp-admin/edit.php?s&post_status=all&post_type=post&action=-1&m=201301&cat=0&post_format=0&paged=1&mode=list

where m is the current month, so 201301 = January 2013. Is it possible to pass edit.php a date in some other format, i.e. a date range? If not, can anyone suggest the best way to generate a list of posts from the last month on the manage posts page?

1 Answer 1


WordPress support advised me you can use the same parameters on the URL as WP_Query() accepts. http://codex.wordpress.org/Class_Reference/WP_Query#Time_Parameters

You can't pass a date range. The best you can do is pass specific dates.

For example, edit.php?s&post_status=all&post_type=post&action=-1&m=201301&cat=0&post_format=0&paged=1&mode=list&day=1 will show all posts from the 1st day of the current month.

When I told this to our content manager he was happy just to have a link to a list of posts from yesterday. In case useful to anybody, here's what I'm doing:

    add_action( 'admin_menu', 'add_admin_listing_filters' );

function add_admin_listing_filters() {

    $yest_time = time() - 60 * 60 * 24;
    $yest_year = date('Y', $yest_time);
    $yest_monthnum = date('n', $yest_time);
    $yest_daynum = date('j', $yest_time);

    add_submenu_page( 'edit.php', 'Recent - All', 'Recent - All', 'manage_options', 'edit.php?s&year=' . $yest_year . '&monthnum=' . $yest_monthnum . '&day=' . $yest_daynum . '&post_status=publish');
    add_submenu_page( 'edit.php', 'Recent - News', 'Recent - News', 'manage_options', 'edit.php?s&year=' . $yest_year . '&monthnum=' . $yest_monthnum . '&day=' . $yest_daynum . '&post_status=publish&category_name=news');


Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.