WordPress.org

Plugin Directory

Quick Drafts Access

Adds links to 'All Drafts' and 'My Drafts' under the Posts, Pages, and other custom post type sections in the admin menu.

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_quick_drafts_access_post_types

The 'c2c_quick_drafts_access_post_types' filter allows you to customize the list of post_types for which the draft links will be shown. By default, draft links will be shown for all public post types, which includes the default post types of 'post' and 'page'. If other post types have been added to your site, they will also automatically be taken into consideration. If you want to explicitly add or remove particular post types, use this filter.

Arguments:

  • $post_types (array): Array of post type objects

Example:

/**
 * Prevents the drafts menu link(s) from being displayed for the 'event' post type.
 *
 * @param array  $post_types The post types that will show drafts menu links by default.
 * @return array
 */
function my_qda_mods( $post_types ) {
    $acceptable_post_types = array();
    foreach ( (array) $post_types as $post_type ) {
        // Don't show the Drafts link for 'event' post type
        if ( ! in_array( $post_type->name, array( 'event' ) ) ) {// More post types can be added to this array
            $acceptable_post_types[] = $post_type;
        }
    }
    return $acceptable_post_types;
}
add_filter( 'c2c_quick_drafts_access_post_types', 'my_qda_mods' );

c2c_quick_drafts_access_show_all_drafts_menu_link

The 'c2c_quick_drafts_access_show_all_drafts_menu_link' filter allows you to customize whether the 'All Drafts' link will appear at all for a post type. If true, then the 'c2c_quick_drafts_access_show_if_empty' filter would ultimately determine if the link should appear based on the presence of actual drafts.

Arguments:

  • $show (bool): The default boolean indicating if the 'All Drafts' link should be shown at all. Default is truee.
  • $post_type (object): The post_type object

Example:

// Completely disable the 'All Drafts' link for all post types.
add_filter( 'c2c_quick_drafts_access_show_all_drafts_menu_link', '__return_false' );

c2c_quick_drafts_access_show_my_drafts_menu_link

The 'c2c_quick_drafts_access_show_my_drafts_menu_link' filter allows you to customize whether the 'My Drafts' link will appear at all for a post type. If true, then the 'c2c_quick_drafts_access_show_if_empty' filter would ultimately determine if the link should appear based on the presence of actual drafts.

Arguments:

  • $show (bool): The default boolean indicating if the 'My Drafts' link should be shown at all. Default is truee.
  • $post_type (object): The post_type object

Example:

// Completely disable the 'My Drafts' link for all post types.
add_filter( 'c2c_quick_drafts_access_show_my_drafts_menu_link', '__return_false' );

c2c_quick_drafts_access_show_if_empty

The 'c2c_quick_drafts_access_show_if_empty' filter allows you to customize whether the 'All Drafts' and/or 'My Drafts' links will appear for a post type when that post type currently has no drafts.

Arguments:

  • $show (bool): The default boolean indicating if the Drafts link should be shown if the post type does not have any drafts. Default is false.
  • $post_type_name (string): The post_type name
  • $post_type (object): The post_type object
  • $menu_type (string): The type of draft menu link. Either 'all' for 'All Drafts' or 'my' for 'My Drafts'.

Example:

// Show the links to drafts even if no drafts exist for the post type or the user.
add_filter( 'c2c_quick_drafts_access_show_if_empty', '__return_true' );

Requires: 3.1 or higher
Compatible up to: 4.3
Last Updated: 2015-9-5
Active Installs: 600+

Ratings

5 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,1,1
100,1,1
100,1,1
100,1,1