Empty argument here does not equal logical in nothing. It equals no value to process and so WP ignores it and goes further as usual.
Just wrap your query in if( !empty( $favorites) )
condition.
Related Posts:
- Is there a flowchart for WordPress loading sequence?
- How do register_sidebar() and get_sidebar() work together?
- Custom maintenance page
- How to customize the default HTML for WordPress Attachments
- Is it possible to change the attributes of a registered style or script before it fires?
- how to change “published date” format on edit.php (Posts page)?
- How can I integrate pages written in something other than PHP?
- How to change submit button value in comment from “Post Comment” to “Send”
- WordPress custom post types breaks permalink on theme reinstall
- Custom field values in permalink
- Creating a searchable A-Z listing of hundreds of companies/services
- Show attribute description when filtering by that attribute
- Custom protected password page with ACF
- Customize in category page
- Custom Dashboard Home Screen Options
- How to get WordPress to accept the tag in articles (or other alternatives)
- Add custom column to Users admin panel with Types user custom fields?
- How do I change the default admin color scheme in MP6
- woocommerce Add custom field set like billing fields
- How can a single line in a blog post take down my server?
- Calling a php file from a javascript file in wordpress
- Adding a Table to the wordpress database
- how can I change the background color of all posts on my server?
- Custom URL going to 404
- TinyMCE custom dialog with selectbox not working
- Publishing html directly from ftp to wordpress
- Load more posts with multiple queries
- Suggestions for Implementing a Wedding Website in WordPress?
- how to get the categories for a single product in a hierarchical way
- Get Date of custom field and use conditional logic
- How to wrap the list with custom class using wp_nav_menu?
- Custom search to display results within same page
- Get ORIGINAL image links from get_post_gallery
- change url for static files in /wp-admin with a cdn url
- Sub menu indicator that links to sub menu
- CSS Customizations for certain page
- How can I have a common background color across multiple WordPress blocks?
- What requirements for ACF custom fields key and name properties?
- Get Custom Taxonomy Terms by Date
- Removing blank space below header [closed]
- Custom Search on Custom Page while preserving the main search function
- Archive subtitles for different types of archives
- Point homepage to custom php page
- If the image variable is specified, show image, if not no code
- Is there another way to customize a parent template file besides adding the file to a child theme?
- Implement a Walker with custom object rather than WordPress database object
- Replacing words in WordPress or theme (not in content)
- WordPress Child Theme Stylesheet being loaded before Parent’s minified .css
- Adding tags when creating new post
- How can I tag a menu item as visited for each unique user?
- Add Member’s birthdate from Backend and shows it on frontside [closed]
- Many Rewrite Parameters/Rules
- Adding other links on header than LinkedIn, Facebook, Youtube etc
- How to have multiple WordPress Menus
- How to Render Post Types in RSS Feed?
- 404 when Previewing an unsaved draft
- Custom Taxonomy Sort For a Custom Query
- Where to upload my new custom ShortCode in Separate .php file?
- Display a specified content on a Page and all its child pages
- kitchen sink not working
- Is it possible to auto sharing post on social network from specifc categories or tags
- wp_insert_post custom taxonomy multiple Category not added
- Custom field not editable by the user
- WordPress category custom title
- How do I make mysite.com/comingsoon WordPress to become my main website’s WordPress?
- Use a custom page with dynamic content as a user profile page
- Can’t upload format files on media library
- Invitation link to a site in multisite network does not work?
- Add helper text in custom-header section in admin
- How to edit content in code view of home page when there is some theme applied?
- How to display strikethrough text in button text (for special offer)
- Remove Title and White Space in Twenty Twenty theme
- How to show Term ID beside Name Category with wp_dropdown_categories()
- Can we add an extra button on woocommerce shop page and use it to send the product info including image in a mail?
- WordPress Performance and bulk edits
- Add a custom intro page
- How to have differents sites share the same tables of DB?
- How to add particular attribute of product in shop as well as home page
- How to change custom link of subpages from of localhost to website
- Duplicate Header and Footer
- Send email notification when post type product is publish from pending status
- Custom login doesn’t stay
- Custom dropdown search form that allows users to select option B based from Option 1
- Smarter Document Management links between three WordPress sites sought
- data retrieval presents last set of data
- Accountless password generation
- Creating a Treeview Listing of a Directory
- How to get name and email value from a custom form and add it to campaign monitor subscriber list?
- Create a google friendly header with text and logo
- Disallow “contributors” to edit their own posts once they’ve been set to “Pending Review”
- insert autofocus in a custom taxonomy form
- Custom Link In WordPress Media “Attachment Details” Upload Screen
- display my pages html
- “Static” pages within a theme
- Custom WordPress SQL Query 4 posts per custom taxonomy
- Changes to code not displaying
- Permalink Listing WordPress
- Has the table name in SQL for WordPress changed from WP_posts to WPCS_post?
- Multi color post title by using custom javascript inside the gutenberg editor?
- Add custom styles to the Raft theme