Filter hook 'get_others_drafts'

in WP Core File wp-admin/includes/deprecated.php at line 715

View Source

get_others_drafts

Filter Hook
Description
Retrieves editable posts from other users.

Hook Information

File Location wp-admin/includes/deprecated.php View on GitHub
Hook Type Filter
Line Number 715

Hook Parameters

Type Name Description
int $user_id User ID to not retrieve posts from.
string $type Optional. Post type to retrieve. Accepts 'draft', 'pending' or 'any' (all). Default 'any'.

Usage Examples

Basic Usage
<?php
// Hook into get_others_drafts
add_filter('get_others_drafts', 'my_custom_filter', 10, 2);

function my_custom_filter($user_id, $type) {
    // Your custom filtering logic here
    return $user_id;
}

Source Code Context

wp-admin/includes/deprecated.php:715 - How this hook is used in WordPress core
<?php
 710  	} else {
 711  		$editable = join(',', $editable);
 712  		$other_unpubs = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_title, post_author FROM $wpdb->posts WHERE post_type = 'post' AND $type_sql AND post_author IN ($editable) AND post_author != %d ORDER BY post_modified $dir", $user_id) );
 713  	}
 714  
 715  	return apply_filters('get_others_drafts', $other_unpubs);
 716  }
 717  
 718  /**
 719   * Retrieve drafts from other users.
 720   *

PHP Documentation

<?php
/**
 * Retrieves editable posts from other users.
 *
 * @since 2.3.0
 * @deprecated 3.1.0 Use get_posts()
 * @see get_posts()
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param int    $user_id User ID to not retrieve posts from.
 * @param string $type    Optional. Post type to retrieve. Accepts 'draft', 'pending' or 'any' (all).
 *                        Default 'any'.
 * @return array List of posts from others.
 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-admin/includes/deprecated.php
Related Hooks

Related hooks will be displayed here in future updates.