You can get the post ID from the slug with the url_to_postid()
function:
$ID = url_to_postid(slug);
then just exclude the ID from your query:
query_posts(array('category_name' => 'Mycat', 'posts_per_page' => -1, 'post__not_in' => $ID ));
You can create an array of post IDs if you need to exclude multiple pages.
Related Posts:
- Problem with ‘post__not_in’
- Sort X categories by last update and show image
- using post__in allow duplicate post id
- Using dynamic conditions in ‘posts_where’ filter
- How to limit search to first letter of title?
- Counter code for paginated category pages in wordpress
- WordPress Search Filter Only for Page with Child of Child of Child of Child of Child
- pagination in author.php template returns 404 error
- Adding Variables to post query
- Tricky WP Query
- query_posts() ALWAYS displays something?
- Using ajax with paging and a custom sub-query
- Each post is showing twice in my custom query…?
- Exclude posts by post meta value
- Can I use WP_Query one time and then filter the results multiple times
- Different layout based on post amount?
- How to solve this without flushing the rewrite rules for each post query the visitor triggers?
- How to check a list or feed of all posts under a category and tag?
- Best Query for blog posts
- Adding Category Argument into an Array for WordPress Query
- Alternative to query_posts for main loop? [duplicate]
- how to query posts by category and tag?
- WP_Query vs get_posts
- Query posts by custom taxonomy ID
- How to return results of a get_posts() in explicitly defined order
- How to order posts by descending comment count on taxonomy page?
- Alter query on edit.php
- Is it better practice to use query_posts, WP_Query, or get_posts to create various custom loops within a Page?
- Best way to load page content in Fancybox popup?
- Total Count of Posts NOT in Selected Categories?
- Replace query_posts with pre_get_posts
- How to display liked posts of current user in wordpress?
- Warning: urlencode() expects parameter 1 to be string, array given in and not getting the preffered output
- Get posts by category with pure SQL query
- Pass the same object to multiple widgets in a template with one query
- Using database meta_values to calculate new post order using pre_get_posts or a ‘request’ hook
- exclude ids through post__not_in
- Taxonomy.php issue with search and filters
- Query all posts and not repeat the same tag
- How do I query for a post by custom field?
- Query posts without a specific ID
- Integrating post archive wtih another source and preserving date ordering
- Order posts using a custom array
- How can I sort homepage by a meta value?
- How to query a custom post type with a taxonomy filter but display post type archive page?
- WordPress query_posts and orderby page order
- IF.. post meta show… Conditional Tag Help…?
- Show Only Posts Owned By Logged In User + my post
- Custom MySQL Query with logic
- Query last updated posts (posts updated in the last 24 hours)
- order posts by meta value on posts page
- Query_post($args)
- Get post and all posts after it by ID?
- trouble with query to fetch next and previous posts
- How do I make query use exact post title
- Different Ways to Query Custom Post Types?
- Simple custom post query for all the posts or many of them not working
- Query Page Content From Theme Options?
- Hook to return true when the_post() is used in a custom while loop
- My post repeats itself on the second page [closed]
- How to remove a plugin filter’s priority on specific loops (custom queries)?
- Proper syntax to add boolean in array()
- using query_posts to pull posts out of a category in a while loop. Getting odd echo
- Echo a numerical value in query_posts
- why to use query_posts() in custom page?
- Query posts to get all but the most recent post
- Always using the same ARRAY on different querys
- Include current post into loop
- Filter post query to only show direct children of category
- How do I use pagination in WordPress?
- Does WordPress run a post query when a page is invoked?
- How exclude 3 latest posts of a category in query_posts
- Custom search SQL Query to add custom field in result
- Multiple posts/pages in one page?
- Calling Posts from Specified Cat
- How do I add a timezone offset to this query?
- query_posts thumbnail condition
- Show posts from specific roles
- How to add an “or” instead of and “and” (&) in a WordPress query?
- Instead of 4 loops, how can I do it better?
- Modify main loop query for paged and meta key
- wordpress query_posts featured page always on top
- Change pure SQL database query to WordPress post query?
- Need to add a space after meta value in query_posts in wordpress for zipcode search
- Tax query get first product with attribute value in pre_get_posts
- Get posts that match defined arrays of tags
- I need query_posts() to order results first by a meta value and then by post ID
- Ordering Posts By Meta Data
- Ordering Posts by parent category, name ascending
- No duplicate tags by category
- why is pre_get_posts not working
- If meta_key has value = 6 | Change the wp_posts.post_date to current date
- Query posts based on parents attribute
- orderby not working for query_posts using array of IDs
- The_content display a different content from a previous loop
- Run second query on page based on author of the first query
- Why doesn’t this page query work?
- Including post data in a sidebar occurring outside of and before the Loop
- Resetting a Query using wp_reset_query() or wp_reset_postdata() does not work
- How to get custom post type posts with certain multiple tags names and category id?