If I’m understanding your specific question (and posted code) correctly, you’re actually trying to exclude the most recent post from your query? If so, there’s a much easier method: use the offset
parameter:
$query2 = new WP_Query( array( 'offset' => 1 ) );
Using this method, you exclude the most recent post from $query2
, and never actually need to run $query1
.
Related Posts:
- Meta_query compare operator explanation
- Exclude post ID from wp_query
- Get array of posts from the current archive page loop
- Custom query incorrectly returning everything [closed]
- Last post ordered by publish date using WP_Query on front page
- Query certain amount of posts from multiple dates
- Meta Query with date and time on the same Day before given time
- In loop: posts have thumbnail AND other variables
- Orderby = none not working [duplicate]
- Add inline HTML to posts published within last 24hrs
- Add and in the header while looping over custom query in page template
- Single page theme
- Pagination not working on static page
- WP_Query search for whole words
- WordPress pagination link always leads to home page
- Query posts with more than 20 comments
- Can certain (site-crashing) limitations on WP_Query in shortcode be overcome?
- Including only current user’s posts in search
- Implementing an OR statement to wordpress wp_query
- How can i simulate “taxonomy__in” in query?
- How do I reset this wp_list_categories query?
- Refine search results using WP_Query
- query_posts: how to show all ‘meta_value’ containing a specific word?
- How to show subcategories using loop?
- Minimize database queries to user tables?
- Query with a meta value inside a given range
- Pagination of a WP_Query Loop in a child-page page template
- Add condition of user capability in WP_query
- add_filter() depending on search term
- Get all products which have both product category
- How to make Meta Query case sensitive?
- Populate tax_query terms parameter with post term
- Fastest way of counting posts of a custom post type in a specific taxonomy term?
- wp_query ‘s’, search filter with pagination is not working
- WP_Query | Tax_Query Relation | Unable to use ‘OR’ as it then allows all products, help me finish my query?
- Why is wp_query causing an uncaught error to is_user_logged_in() not defined?
- Modify wp-query and sort by post meta key
- Check if loop has any categories?
- WordPress query with items from more than one selfdefined taxonomy as `term` argument
- How to display an other custom post type in a different custom post type’s archive?
- Replacing raw database query to WP_Query
- get_post_meta in WP_Query
- How to alter local query, not main query [duplicate]
- WP CLI can’t delete plugin related table
- Inserting HTML to close and open divs in WP_Query loops
- Hide posts with meta key in WP_Query
- How do I get my custom query to work with search results after the first page?
- Need Sub-category with main Category
- Easy way to write complex queries in wordpress
- JSON – Create rest api endpoint for Advanced Custom Fields
- Query_vars support in Rest API
- Is it possible (and how to) query single Gutenberg blocks?
- Continue or break the while loop
- Custom query filter by ACF date custom field
- Child pages not affected by orderby
- Write WP Query that selects posts that are part of the same two categories
- Sorting posts by Multiple custom fields in defined order
- How to build the WP_Query using the code?
- Phpmyadmin – post editing
- How go give $value to wp_query
- Show multiple tax_query from 2 or more post_type in a single code
- Disable (or limit) queries when certain content (or data) is not needed (or showed)
- Query not sorting DESC
- How to use rewind_comments() – when and how to use it?
- How to make a query returning pages from multiple parents
- Prioritising and Ordering Posts By Category Name Using A Custom Loop
- Filter products on category AND tag
- create a custom query for posts managed by Restrict Content Pro
- How do I stop the same post showing multiple times in a archive?
- Searching for a specific month in a metadata saved as Timestamp (Wp_Query)
- Related categories order posts by category
- Wp_Query Post per page not working?
- Order Element By Custom Field in WordPress
- Display All Top Child Categories / Taxonomy
- how to get custom attachment url?
- WP_Query on custom key and value
- Set “editor” role to existing user
- how to get wp_query posts only first letter of alphabet A?
- Query child posts with tax query on parents
- How to break up output of posts for different terms on same page?
- How to mix two orderby-parameters into one ordered result
- Custom Post Type WP_Query with filters and search
- Get posts by similar names and categories
- Query by meta value (add a dropdown of all values)
- Calculating efficiently on large amount of data generated by wp_query
- WP Query issue for multiple values
- Calling a function with WP_Query only ever brings the first result
- How To Query All Attachment Images Found In Post Galleries
- Return on a quest all these meta_value
- WordPress meta_query not working
- Filter WP_Query output before it is accessed (pre_get_posts)?
- $wp_query when new WP_Query
- Divide WP_Query posts by date & post type
- Unable to pass variable
- New WordPress WP Query using posts from certain categories
- Edit WordPress loop, taxonomies, & filter
- WP query based on two meta queries
- WordPress website links redirect to homepage
- How to display posts from a specific term first then another posts from another terms using tax_query
- Display post format post in the sidebar