As Milo ( and your errors ) point out: you’re passing an array where a string is expected. According to WP_Query tag parameter
Show posts associated with certain tags.
- tag (string) – use tag slug.
To get around this you just need to pass a comma separated string:
function custom_tags( $query ) {
$query->set( 'tag', 'custom,general' );
}
add_action( 'pre_get_posts', 'custom_tags' );
Related Posts:
- Looping through WP_Post Object
- Displaying Only Certain Tags in Loop
- How can I add multiple ‘tax_query’ arrays via a loop?
- Checking array against author id in loop
- List posts that don’t have a specific tag?
- Filtering a function’ output for a new continued function
- How to get the last category name of a child category?
- WordPress loop by meta key that is an array? and how loop multiple arrays
- Only show first image in foreach loop
- Get all posts as an array ID => Name
- Limit tags shown in post
- in_array not working on dev server but works on localhost
- ACF – Get ID of relationship field in flexible content
- Show the subcategory name based on current product
- View tag description on page
- Get a list of tags present in a paged front page
- Display product attributes for current product
- WP_Post is not from correct array
- Create Customization Controls from Array
- Displaying post per day
- How to add active class to custom menu using while loop and wp_list_pages
- Print html when custom field has value inside while loop
- post__in – Placing content from a foreach loop inside of an array
- Need to get specific data from array
- When would you use $_post instead of $post?
- How do I display the function the_content in this loop?
- Advanced Custom Fields: Post Object – Not returning data [closed]
- How to convert objects into arrays
- multiple if statements [closed]
- Admin Options page. Save as Array
- PHP get the first post separately from array returned by wpdb->get_results()
- Call global variable array() in woocommerce child/template
- Custom Tag Description unable to display just below and outside of the Loop
- foreach loop still echoes array
- Blog posts repeat
- How to set variable, pass it to a partial file and remove it after?
- Can’t find infinite loop cause
- Checkbox doesn’t stay checked, conten
- If tag equals then show else show
- Way to bulk make all my tags lowercase?
- Add content after the first post in WP Loop
- How to fix this warning:call_user_func_array() expects exactly 2 parameters, 1 given in D:\wamp\www\…….\wp-includes\class-wp-hook.php on line 286
- How to use if statement in an array? [closed]
- Display an image if odd number of posts in grid
- How to loop through all the attached images in a post, and get their url one by one
- Output meta into arrays
- How do I create a numbered list with PHP? [closed]
- 2nd page displaying the exact same posts as my first page (minus the very first post)
- Is the 404 page automatically displayed if a loop returns nothing?
- Show recent posts starting at a specific number archive
- Warning: in_array() null given in PHP function
- How to pass a variable to get_template_part that’s updated every time the template part is called?
- use loop to return blog details
- Getting posts to exclude from array
- WP Query Leads to 502 Bad Gateway (Timeout Because Query Takes Too Long)
- How to add post meta in while loop?
- Calling function in loop causes repeat data
- how to make an array of post id’s in is_single
- How can I split my query result in 2 arrays?
- Order a WP_Query by meta value where the value is an array
- WordPress call post-ID in jquery
- How to Generate a list of Most Commented post?
- How to pick “full/thumbnail” images in the loop?
- How to Fix an Archive.php That Displays All Posts?
- How to add ASCII symbol after each recent post [closed]
- Using multiple variables to assign categories to an array
- Search.php gets metadata from first post
- the_post(); prints out style text into my HTML?
- Repeat a function with 24hrs gap for n number of days
- update_user_meta as multiple value but with same meta key
- WP post meta – for loop inside for loop
- Accordion headings cuts off to second line on collapsing a accordion heading (used acf repeater)
- WordPress Recent Posts – Loop
- ACF background-color per post in a WordPress loop
- Store custom field’s multiple values in one user meta key
- Advertisement in Loop Posts wordpress
- Trouble with checked() for array of multiple checkboxes
- Adding custom PHP to existing loop in Genesis
- How to Pass Current Taxonomy Terms into new WP_Query?
- How to use foreach and if statement within array of arrays?
- For each 3 posts, show a different post type
- Loop returns more items than exist?
- Modify category archive page loop on functions.php
- Post formating on Home page
- divide custom field values in div every two values
- WP Knowledge Base Theme bug – Subcategories and Articles, Need to change WP_Query
- Limit ads appearing more than three times
- Adapting a php array to WordPress
- Pagination on Custom Loop
- What is the best way to get the first few post from WordPress in different divs using a loop?
- Custom single.php files for different post formats
- Troubleshooting “loopback requests that take too long”
- What is this mark for “? function()” [closed]
- How to combine array info [closed]
- Loop on a wordpress Page instead of content coming from the WP text editor
- Help with if/else loop [closed]
- get_body_params() is always empty in POST request
- save array of objects with update_option
- How to initialise WP_Query on the basis of a specific meta_value and continue iterating rest?
- How to get posts by a certain author in inner loop using outer loop variable or post title WordPress