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 show related posts by detecting the current category?
- Get Posts Under Custom Taxonomy
- Keep featured content post in homepage with original order
- How to change the case of all post titles to “Title Case”
- How to get posts published between a date and today?
- How to get post content by calling ajax?
- Apply the_title() filter in post & page title, but not in menu title
- Get the ID of the latest post
- the_author() returns empty string
- get_children() Not Working with orderby Parameter
- How to get all posts related to particular category name?
- get all posts ID from a category
- Remove post title input from edit page
- Display all posts from specific categories on a page
- Set Post Title to Read-only and Disable Permalink Slug Editor in Gutenberg
- get comments and get posts in loop
- Disallow Same Post Title
- Get title of post without using the_title();
- Verify if tag is used on posts
- How to exclude latest x posts from a paginated query?
- How to know if get_posts() failed?
- Display content from a specific category
- post_name empty after wp_insert_post
- Dynamically update post title in admin page
- Query posts distinct authors
- Number of posts per page setting is not working?
- Show the title of the latest post by author
- WordPress Posts Out Of Order after 3.1 Update
- How to show posts rank based on custom field value
- Setting pagination for images attached to a post
- Insert custom div between posts
- Can’t show comments count per post outside loop
- is there a better way of combining this?
- Only display posts with comments
- Order post by year DESC and month ASC
- Displaying Page Title on index.php
- How to Display Post View Count
- Different amount of posts on homepage than paged pages
- Featured Posts for Category Pages
- Quickest way to get last or oldest post date – WP Query
- Testing for post title in ‘if/else’ statement returns no content
- Cannot Update A Post, 404 Error
- get_post_field – Title without paragraph
- Function to show random posts from a category
- Add Category name to Post Title (h1)
- How to add a custom field after wp post
- Hiding posts in a list from specified categories
- Sorting posts alphabetical that have single digits
- Posts are not showing up on particular category
- get selected post using $_GET
- How would I get 1 latest post from a query for 5 posts?
- Filter Posts By Tag
- setup_postdata doesn`t seem ot be working
- Exclude posts with empty post_content in wp_query
- I want to show category in the post title , how can I do
- Encrypt / Decrypt Post Title and Details
- Get Posts via Taxonomy Term Name with Space
- Get specific posts by ID in wordpress
- How to prevent WordPress from updating the modified time?
- Improving WP_Query for performance when random posts are ordered
- How to display following posts titles in separate div’s on a separate webpage
- Create dropdown list post
- I would like to give special promotion for the first 100 posts in my blog? Can anyone tell me how to do that?
- Blog Posts not showing title
- Automatically republish old posts
- previewing my posts on static page?
- Exclude newest post from category X but show rest
- Lose “Blog Archive” from page title
- get_next_post() and get_previous_post() return wrong posts
- Reset Popular post query?
- How to Orderby Comments by post title?
- Get posts by name and taxonomy term
- How To Get Posts With A Specific Word