-
Couldn't load subscription status.
- Fork 6
Open
Description
I used the following shortcode: [display-posts-remote url="https://www.billerickson.net"]
This generated a GET request to https://www.billerickson.net/wp-json/wp/v2/posts?_embed&categories=0&per_page=10&order=desc&orderby=date
I then get the no posts message because I don't have any posts in category with ID = 0.
When I change:
if ( ! empty( $atts['category_id'] ) ) {
To
if ( ! empty( $atts['category_id'] ) && ( is_array( $atts['category_id'] ) || false !== filter_var( $atts['category_id'], FILTER_VALIDATE_BOOLEAN ) ) ) {
It works. This will ensure the variable isn't anything falsey, like 0, false, and "false".
The last one is important for shortcodes because someone could type [display-posts-remote category_id="false"]
Metadata
Metadata
Assignees
Labels
No labels