Hook into the posts_where
filter and add your condition to the query:
add_filter('posts_where', function($where){
global $wpdb;
return "{$where} AND {$wpdb->posts}.post_title REGEXP '^[0-9\$\@\!\?\%]'";
// add other symbols in the regex above ^
});
Then do your query:
$my_query = new WP_Query(...);
You may want to remove the filter after you get the results (make it a normal function so you can pass the name to remove_filter
).
Related Posts:
- How to merge the content of posts that have the same title?
- How to show related posts by category
- How to display posts by current user/author in a custom page template?
- How to get previous 10 days post from a specific date – WP Query
- Query only Posts from Both of Two Category?
- WordPress get posts by date without query_posts
- How to intercept Post Title on Post-Save
- How Can i Get 5 Recent Post Title With Corresponding Link?
- Can I set and show “important” post in my blog?
- Inserting custom data to the_post() during loop
- WordPress not opening posts with only numbers if permalink is post_name
- Why is querying posts messing up my pages?
- How to get posts from a current post’s month?
- Wrong post title displayed from loop
- While loop articles – if statement order
- get_the_title outputs title until spacing; it does not get full length of title
- Display Posts with template on a Page
- How can I remove the first two words and shorten get_the_title()
- Post Filtering by GET URL parameters
- How to give classname to post if post has no content?
- Get posts from current category?
- get posts, run a custom query, and join the results
- Post title not displaying as recorded in the wp_posts table
- WP_Query to get posts in a specific tag or has post_format
- Get post title of faulty link on 404 error page
- Title displaying multiple times
- Word count for all posts of all authors
- How to get post content by calling ajax?
- Apply the_title() filter in post & page title, but not in menu title
- get all posts ID from a category
- Remove post title input from edit page
- Disallow Same Post Title
- Verify if tag is used on posts
- Dynamically update post title in admin page
- Number of posts per page setting is not working?
- Can’t show comments count per post outside loop
- is there a better way of combining this?
- Displaying Page Title on index.php
- Quickest way to get last or oldest post date – WP Query
- How to add a custom field after wp post
- Encrypt / Decrypt Post Title and Details
- How to prevent WordPress from updating the modified time?
- Improving WP_Query for performance when random posts are ordered
- How to Orderby Comments by post title?
- How To Get Posts With A Specific Word
- Why WP_Query(‘showposts=5’) shows only 1 post?
- Include sticky posts on the static page front page
- Get attachments for posts that belongs to a specific category
- Any way for get_next_post() to use the actual post order instead of publish order?
- Multi row post list
- posts_per_page option limits the number of Gallery items
- Nested WP_Query breaking loop
- Create a list of posts with topic headdings
- How to get post content from an array of ids?
- Number of displayed posts
- Query for first 3 posts to change the look and feel
- WordPress post filter menu
- get_posts not pulling the correct number of posts
- Get featured image on hover of post title [closed]
- WordPress query portfolio posts
- How to get posts ordered by using their categories?
- List latest posts with least comments in WP-Admin
- Display 3 posts with different HTML markup using a loop
- How to assign a post to a post parrent?
- query for filtering published posts?
- get parent fields title, content excerpt etc
- AWS usage queries
- Pull in posts using post meta for REST API
- How to select a category automatically based on a word in WordPress post title?
- How to show multiple posts thumbnail, title and date in widget
- Show only posts with titles/permalinks that do not contain certain words
- How to fetch courses in all languages in WordPress?
- How to show post views shortcode data for each post on Posts List Page?
- How can I use query_posts to loop through posts and construct my own content?
- Assign a day of the week to post, e.g: Assign Monday to post and have it only appear when the day is Monday
- Odd hyphen added at end of blog post
- Show 5 posts and than 3 posts offset with pagination
- My posts page is missing the page title
- Hiding title of selected post without plugins
- Make recent post display recent updated, instead of recent published
- How to Get Position of a Post from a category and tag
- Any difference betweenn posts and pages for one page?
- Post title to show all characters after having it limited for preview
- Sort / Filter Queries
- get_page_by_title() not working if special characters are present
- Modify WordPress loop after it has been run
- Add Image Before Posts Entry Title
- Ordering posts alphabetically by meta keys and title
- Why I have this strange behavior when I try to exlude the featured post from posts visualization?
- How do I control the fallback query after the original query returned cero posts?
- prevent same wordpress post title
- Remove duplicated posts in the loop if post has more than one category
- Adding a category at even positions on main loop with modified pagination
- Is it possible to have different header style blog titles in different categories?
- How to limit post query to only return a total count of items with certain post statuses?
- Load posts from external source if not found in database
- Not displaying any articles on a custom made file
- Sort Posts Alphabetically Based on Specific Category (Divi)
- How to change url of posts?
- How to link Post Title to uploaded file?