Fix: Share a Draft Plugin, Getting Only 5 Posts - WordPress

Fix: Share a Draft Plugin, Getting Only 5 Posts – WordPress

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.

Video Tutorial:

You just need to follow the steps below:

  1. From your WordPress admin panel, goto “Plugins > Plugin Editor”.
  2. Select plugin to edit “Share a Draft”.
  3. Select plugin file “shareadraft.php”.
  4. Search for 2 variables; “$my_unpublished” and “$others_unpublished”.
  5. 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
) );
  1. Click the “Update File” button and refresh your “Share a Draft” page.

Then you will be able to view all of your drafted posts.

Leave a Reply

Please disable your adblocker or whitelist this site!