In this tutorial, we are going to teach you, how you can display all posts in your Share a Draft plugin in WordPress. Share a Draft is a plugin that is used to share your unpublished posts using a link. In WordPress, by default only published posts are shared. You can download the plugin manually from here.
You just need to follow the steps below:
- From your WordPress admin panel, goto “Plugins > Plugin Editor”.
- Select plugin to edit “Share a Draft”.
- Select plugin file “shareadraft.php”.
- Search for 2 variables; “$my_unpublished” and “$others_unpublished”.
- Add the “nopaging” value in “get_posts” function of both of these arrays.
$my_unpublished = get_posts( array( 'post_status' => $unpublished_statuses, 'author' => $current_user->ID, // some environments, like WordPress.com hook on those filters // for an extra caching layer 'suppress_filters' => false, "nopaging" => true ) ); $others_unpublished = get_posts( array( 'post_status' => $unpublished_statuses, 'author' => -$current_user->ID, 'suppress_filters' => false, 'perm' => 'editable', "nopaging" => true ) );
- Click the “Update File” button and refresh your “Share a Draft” page.
Then you will be able to view all of your drafted posts.