WordPress.org

Forums

Dynamic Widgets
[resolved] posts_per_page and CPTs output (5 posts)

  1. Steve Taylor
    Member
    Posted 4 years ago #

    Hi,

    On the Dynamic Widgets edit screen, where it lists all the individual posts in each Custom Post Type module, only 5 are coming through. This is the number I have set in the Settings for posts_per_page. Shouldn't the query to get the posts have -1 set for this explicitly?

    I'm working around this with a filter in my theme's functions.php:

    add_filter( 'pre_get_posts', 'slt_dynwid_cpt_fix' );
    function slt_dynwid_cpt_fix( $query ) {
    	if ( isset( $_GET['page'] ) && $_GET['page'] == 'dynwid-config' && isset( $_GET['action'] ) && $_GET['action'] == 'edit' ) {
    		$query->set( 'posts_per_page', -1 );
    	}
    	return $query;
    }

    http://wordpress.org/extend/plugins/dynamic-widgets/

  2. Steve Taylor
    Member
    Posted 4 years ago #

    PS. I have this in an include that's only run for the admin. If you're just putting it in functions.php, maybe include is_admin() in the condition there.

  3. Qurl
    Member
    Plugin Author

    Posted 4 years ago #

    I've been unaware of this! Thanks for letting me know. I'm going to have a look and let you know what I find out.

  4. Qurl
    Member
    Plugin Author

    Posted 4 years ago #

    Hi again,

    I was able to reproduce the bug. So, I've added a fix for it by adding the posts_per_page argument to the query in the development version 1.4.0.17. I'll release version 1.4.1 soon.

  5. Steve Taylor
    Member
    Posted 4 years ago #

    Great, thanks!

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Dynamic Widgets
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic