This is incorrect formatting of a PHP array:
'cat' => '4', '5', '6', '7'
Use category__in
and pass an array of category IDs:
$args = array(
'posts_per_page' => 4,
'category__in' => array( 4, 5, 6, 7 )
);
See WP_Query
for all valid parameters and how to format them correctly.
Related Posts:
- Error Warning: Declaration of description_walker::start_el after PHP upgrade [duplicate]
- Mega Menu Walker
- Displaying Logged-In User Name in WordPress Menu
- Autoloading in Child Theme
- How to add a class to the attachment images
- How to call a function only once (global variable scope)
- Set media upload attachment link to none and hide it in WP v3.5
- How to correct schedule my event weekly with wp_schedule_event()
- Execute a shortcode when clicking on a image
- add_rewrite_rule with bottom priority doesn’t handle the WordPress pages
- How to add default images into theme customizer image control?
- Successful or Error Message after running mysql code in functions.php
- How can one utilize a variable as a callback function name for add_settings_field
- Change logo based on incoming domain
- Custom Logo URL | Help me print the URL of the custom logo I inserted into my theme
- Count the number of times the search form template gets included on a page
- PHP code inside shortcodes
- How do I display a user’s previous orders as a select box option on a product?
- Adding Default Settings to Theme My Login plugin
- Remove meta description on certain pages
- Image media upload metabox
- How to combine wordpress_logged_in cookies in one cookie?
- Two Different Links for Same Product – WooCommerce [closed]
- function to assign user role based on a field from usermeta
- Woocommerce related product text
- esc_html_e() is not translating string in wordpress [closed]
- WordPress Gravatar filter is removing my custom attributes
- Incorrect amount of posts returned when filtering related Woo products by custom taxonomy
- Limit 1 global comment per minute
- Modify custom field input data before creating a new post
- Remove echo from shortcode
- Is there a way to conditionally check whether a WordPress post title is empty?
- Copyright info change – Corporate Plus Theme PHP [closed]
- Inject class in body when particular page template is used
- Echo a function inside a function
- Use WordPress function in php file
- Get my site session in wordpress?
- How to list posts from a plugin taxonomy?
- wp_force_remove_style’ not found
- is_user_logged_in() not working in AJAX validation call
- Register a menu – Error Header
- Pagination on Custom Post
- first instantiated SimplePie object cosumes 5mb?
- Theme not calling Jquery properly
- WordPress redirect redirecting too many times or not at all
- how to save checkbox data for custom setting?
- How to keep the capability of users and disable Gutenberg editor in WordPress?
- Add product to cart for user – WC()->cart->add_to_cart [closed]
- How to create a field in customize and show that in header.php?
- If Array Values Match Another Array’s Values, Then
- Enqueing External JS on the remote server JS
- iframe not showing in content on blog page
- Get user custom field value on function.php
- Open and closed function [closed]
- Need to Modify a WordPress Shortcode with another wordpress shortcode
- Get the name of menu item with wp_nav_menu
- How to add aria role and schema markup to custom walker container
- PHP Output also in Child theme, but different
- Remove submenu item from list
- Taxonomy term description with style, only if the description exists?
- How to change the author box selection on a post to a custom taxonomy
- Output product category link from WP_Query
- Adding onload to body for certain pages
- Delete images from media library when user deletes an image from ACF Gallery
- Reject all malicious URL requests functions.php
- How to send a php var to jQuery Ajax call with two different file
- Change wordpress’ database data using ajax – how to get current user id?
- copy fields value to another field
- not outputting medium size image URL
- Get parent category name when only child category is applied to a product
- Best way to use variables in multiple functions?
- Can an AJAX callback function access a PHP variable which was defined during initial page load?
- Notice: Undefined variable
- Cannot fetch posts with certain ‘product_cat’. WP_Query is empty
- How to override WooCommerce Order Item Meta with data from Cart?
- Detect what link user clicks and Redirect to a specific page for logged in users only
- Offset with ajax load more posts duplicates
- How fix error in the WordPress loop?
- Need help with PHP functions
- Use WP_Query Data In Cookie
- Extend the WP_Customize_Image_Control class to change its non-frame $button_labels
- WordPress styling recent post
- Break a WordPress function to run in patches and re-continue
- syntax error unexpected ‘}’ at 364 line
- get_post_meta no longer working
- Highlight posts currently being edited on multiple editor site?
- Showing all post from all post type in admin backstage
- Pagination not displaying
- Setting WooCommerce currency programmatically
- Masking external links with internal link for member-only
- Shortcode to include PHP file, pass various parameters to include?
- Why can’t I include echo inside a variable? [closed]
- Assign new post author IF another user in custom field on post transition
- Create and publish a new post every Monday, listing the post titles and links to the posts published during the previous week
- How do I change the Go To Categories link in the term_updated_messages
- WooCommerce – Show ‘Sales’ badge on variable products where only some variations have sales price [closed]
- Dynamic Email Handler with ‘header (“Location: …’
- a problem in class in class-wp-hook.php
- change title of page dynamically
- Custom plugin doesn’t show in admin menu – when code added, displays an empty page