It is not advised to used query_post()
as it replaces the query of the page with new instance of the query. For general post queries, use WP_Query
or get_posts
.
here tag__not_in
takes id of the tag and not the slug
, so replace sold
with the id of the tag sold
like
$args = array(
'orderby'=> 'date',
'order' => 'DESC',
'tag__not_in' => sold_tag_ID
);
$allposts = new WP_Query($args);
Related Posts:
- Nesting if statements to echo only one string based on what tag was filtered?
- Filtering a function’ output for a new continued function
- How to tag the main tag? [closed]
- Multiple Tag Filtering
- Contact Fom 7 – how to add custom HTML inside span.wpcf7-form-control-wrap AND IMMEDIATELY AFTER input.wpcf7-form-control?
- Removing “wpautop” (auto tags) only on certain pages?
- Add filter when image is uploaded?
- Remove the first 5 characters of the_title and orderby that
- Remove a div from RSS feed
- Print last modified date only on posts
- How to add an arrow to menu items has submenus
- WordPress Gravatar filter is removing my custom attributes
- Generating an nonce for Content Security Policy and all scripts – How to make it match/persist for each page load?
- Unique icons next to each WordPress menu item
- Adding Taxonomy Image to taxonomy loop [closed]
- Change tinyMCE editor to allow marked content when pasting from Word
- Problem with login form
- Sort by page information by Ascending Numbers
- If tag equals then show else show
- Way to bulk make all my tags lowercase?
- Pull Tags But Not as Links
- Adding Meta Tags to a Post using its Tags, Excerpt and content
- Alter required message using comment form api
- How to debug this search & replace strings snippet?
- Hide Featured Image Meta Box on Editor Screen
- List posts that don’t have a specific tag?
- Add item to top of menu using a filter in functions.php
- Add filter multiple times using only one master function
- How to edit php code in WordPress Post file?
- Change page title from page using php via php executed from page/post itself
- How to make modifications only to certain elements of an HTML string on the server-side?
- Override a function defined in wp-includes/comment-template.php
- Edit the_category (); for a hierarchical display
- Need to put a script above tag in header.php – WP 5.7.1
- Use Tags to initiate Search
- Trying to prepend a Hashtag symbol to the_tags links [closed]
- stripping tags from excerpt in WordPress is not working
- Deleting Certain terms from appearing on the front end as links
- Content filter won’t work
- How to keep track of when a vote is cast?
- Warning: in_array() null given in PHP function
- Upload multiple files in randomly generated folder using wp_upload_bits
- Create page template via functions.php?
- Add meta tags to a custom header
- Ajax filter button display all posts
- How to append to an array and return the results in a filter?
- How to have different site identity logos on each page on Astra Theme [closed]
- change the default order of posts only for specific categories
- How do I create a secondary version of the_content
- Get the_content surrounded by instead of
- Custom query vars filters problem with pagination
- Filter by field with array value in ACF on WP REST API
- Order BY Most Liked And Published Between Previous Week Monday And Next Week Monday
- wrap a span tag around author’s post count
- Get the name of menu item with wp_nav_menu
- Displaying content on posts page based on category
- update_post_meta() not saving data inside of save-post filter
- How to add aria role and schema markup to custom walker container
- Can I remove or edit an include() from a function with a filter?
- Removing custom sort order from admin page listing
- Querying for specific tags
- Dynamically adding filters
- Limit tags shown in post
- Must filter functions receive all arguments passed to them?
- How to add Post Tags to a new element in header.php?
- Commas in Tag Cloud
- WordPress doesn’t load HTML
- making my own “related pages” / “pages you might like” section
- Getting a WordPress tag to print inside of a traditional php echo
- How to internationalize header image?
- apply_filters with several different values?
- How can I modify this code to make the search box include tags and meta
- remove specificly the last tag in all posts
- User filter posts by year
- How to exclude labels from certain categories in a shortcode?
- How to add a custom filter (by coding) before access one wordpress page ? And where to call the custom filter?
- How to sort WooCommerce products page by latest in-stock items first?
- How do I make these combination select filters work when only one dropdown is set? They work in WordPress 5.8.2 but don’t in 5.8.3
- Show related products by attribute based and certain conditions
- How to Create custom block for displaying information in content section which act like shortcode
- Filter wordpress posts without searching the keywords in the post content
- Variation prices breakdown only for single product page
- Test the existence of a page/article by its URL, taking in consideration the URL rewriting by filters
- Filter ‘comment_notification_text’ not working
- Tag title not being returned in page title of tag archives
- Remove Author Links
- How to run php code only for a specific widget on a page and not all widgets on that page?
- How to remove get_header From all single pages in wordpress with functions.php without plugin?
- WordPress sorting posts by date and title using a dropdown
- Apply function.php filter only if url not has /amp/
- Change the “Show All” button in a WordPress Portfolio Filter
- How to add Text before my Custom Term and hide it when empty
- How to use apply_filters() inside a plugin class?
- Change lost password url to a mailto URL in WordPress
- Shortcodes not processing inside post content
- Remove span tags from WooCommerce Downloads page
- How to edit post meta data before publishing the post it self wordpress?
- Add a top bar to a wordpress theme without editing the header.php file?
- I want to hide “sold by” on certain pages with id page 43
- clicking on the_tags() generated tags to show all tagged posts page