WordPress.org

Ready to get started?Download WordPress

Plugin Directory

Admin Post Navigation

Adds links to navigate to the next and previous posts when editing a post in the WordPress admin.

Filters

The plugin is further customizable via four filters. Typically, these customizations would be put into your active theme's functions.php file, or used by another plugin.

c2c_admin_post_navigation_orderby (filter)

The 'c2c_admin_post_navigation_orderby' filter allows you to change the post field used in the ORDER BY clause for the SQL to find the previous/next post. By default this is 'ID' for non-hierarchical post types (such as posts) and 'post_title' for hierarchical post types (such as pages). If you wish to change this, hook this filter. This is not typical usage for most users.

Arguments:

  • $field (string) The current ORDER BY field

Example:

add_filter( 'c2c_admin_post_navigation_orderby', 'order_apn_by_post_date' );
function order_apn_by_post_date( $field ) {
    return 'post_date';
}

c2c_admin_post_navigation_post_statuses (filter)

The 'c2c_admin_post_navigation_post_statuses' filter allows you to modify the list of post_statuses used as part of the search for the prev/next post. By default this array includes 'draft', 'future', 'pending', 'private', and 'publish'. If you wish to change this, hook this filter. This is not typical usage for most users.

Arguments:

  • $post_statuses (array) The array of valid post_statuses

Example:

add_filter( 'c2c_admin_post_navigation_post_statuses', 'change_apn_post_status' );
function change_apn_post_status( $post_statuses ) {
    $post_statuses[] = 'trash'; // Adding a post status
    if ( isset( $post_statuses['future'] ) ) unset( $post_statuses['future'] ); // Removing a post status
    return $post_statuses;
}

c2c_admin_post_navigation_post_types (filter)

The 'c2c_admin_post_navigation_post_types' filter allows you to modify the list of post_types used as part of the search for the prev/next post. By default this array includes all available post types. If you wish to change this, hook this filter.

Arguments:

  • $post_types (array) The array of valid post_types

Examples:

// Modify Admin Post Navigation to only allow navigating strictly for posts.
add_filter( 'c2c_admin_post_navigation_post_types', 'change_apn_post_types' );
function change_apn_post_types( $post_types ) {
    return array( 'post' );
}
// Modify Admin Post Navigation to disallow navigation for the 'recipe' post type
add_filter( 'c2c_admin_post_navigation_post_types', 'remove_recipe_apn_post_types' );
function remove_recipe_apn_post_types( $post_types ) {
    if ( isset( $post_types['recipe'] ) )
        unset( $post_types['recipe'] ); // Removing a post type
    return $post_types;
}

c2c_admin_post_navigation_display (filter)

The 'c2c_admin_post_navigation_display' filter allows you to customize the output links for the post navigation.

Arguments:

  • $text (string) The current output for the prev/next navigation link

Example:

add_filter( 'c2c_admin_post_navigation_display', 'override_apn_display' );
function override_apn_display( $text ) {
    // Simplistic example. You could preferably make the text bold using CSS.
    return '<strong>' . $text . '</strong>';
}

Requires: 3.0 or higher
Compatible up to: 3.8.3
Last Updated: 2013-12-29
Downloads: 33,820

Ratings

4 stars
4.9 out of 5 stars

Support

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
0 people say it's broken.

100,1,1
100,3,3
100,2,2 100,1,1
50,2,1 100,1,1
100,3,3
100,1,1
75,4,3
100,1,1
100,1,1
100,1,1 100,1,1
100,3,3
100,2,2
100,1,1
100,2,2
100,1,1
100,2,2
100,2,2
100,2,2
100,1,1