Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit => -1 appears to be ignored #22

Open
jonathanstegall opened this issue Jul 25, 2018 · 1 comment · May be fixed by #23
Open

Limit => -1 appears to be ignored #22

jonathanstegall opened this issue Jul 25, 2018 · 1 comment · May be fixed by #23

Comments

@jonathanstegall
Copy link

I have a field that should theoretically allow unlimited posts to be attached to it, but I think adding -1 as the limit attribute gets ignored.

Here's an example when I put a limit of 50.

Code:

$newsletter_top_posts->add_field(
    array(
        'name'       => __( 'Top Stories' ),
        'desc'       => __( 'Search for a post here', ),
        'id'         => 'top_posts',
        'type'       => 'post_search_ajax',
        'sortable'   => true,
        'limit'      => 50,
        'query_args' => array(
            'orderby'    => 'modified',
            'order'      => 'DESC',
            'date_query' => array(
                array(
                    'column' => 'post_modified',
                    'after'  => 2018-07-23 11:45:25,
                ),
            ),
        ),
    )
);

Screenshot:

image

Code when I use -1 instead:

$newsletter_top_posts->add_field(
    array(
        'name'       => __( 'Top Stories' ),
        'desc'       => __( 'Search for a post here', ),
        'id'         => 'top_posts',
        'type'       => 'post_search_ajax',
        'sortable'   => true,
        'limit'      => -1,
        'query_args' => array(
            'orderby'    => 'modified',
            'order'      => 'DESC',
            'date_query' => array(
                array(
                    'column' => 'post_modified',
                    'after'  => 2018-07-23 11:45:25,
                ),
            ),
        ),
    )
);

Screenshot:

image

So it uses the first item and then doesn't let me add any additional ones. Is this a bug, or am I missing how this ought to work?

@jonathanstegall jonathanstegall linked a pull request Jul 25, 2018 that will close this issue
@scottsawyer
Copy link

Just noticed this issue, would be great to get this merged!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants