Something like this will probably work:
$results = array();
$allPosts = get_posts('post_type=post&numberposts=-1');
foreach ($allPosts as $aPost) {
if ( substr($aPost->post_content, 0, 1) == '<' || substr($aPost->post_content, 0, 2) == '<a' )
$results[] = $aPost->ID;
}
echo "<pre>".print_r($results,true)."</pre>";
UPDATE: but you should revisit the MySQL approach in the links you provided. This php method is somewhat wasteful as it gets everything, instead of only whats needed.
Related Posts:
- ajax category filter
- WordPress 4.9.5 PHP intermittent warning trim() expects parameter 1 to be string, array given
- Pagination custom query
- Order by two meta keys
- Finding all results from database within 500 miles of the given latitude and longitude [closed]
- Function to check if author has posted within the last x days
- Shortcode returns escaped HTML tags
- Calling a custom excerpt function in a local loop
- How to get any tag ID
- Dynamically Override Fancy Title – Part II
- query posts in functions.php and update a field
- Get posts using WP_Query
- Best practice custom function, where to echo the variables?
- How to get user_id from wordpress database inside ajax function?
- posts_per_page not working
- Exclude admin from WP_Query Contributors
- Multiple Loops Inside a Function
- How to delete taxonomy term when a wordpress user is removed?
- Exclude category for main query and custom
- Display posts from only one post form in custom query and exclude in main query
- Category applied to pages, creates multiple breadcrumb entries after a search query (On the translated site)
- How to filter, restrict and return posts based on custom user meta information
- WP Query using tax_query & meta_query
- wordpress search word, “hello world” ===> ‘hello+world’ ===> ‘hello’, ‘world’
- Display most popular in the past two days
- meta_query not working as expected
- New WP_Query calls Pre_get_posts filter twice
- how to access query string in wordpress?
- Merge two search functions for custom post type
- Make a SQL query with wpdb in WordPress
- how to use pre_gets_posts to exclude one queried ID from homepage loop
- Error with function in functions.php?
- Exclude authors IDs from WP_Query
- Loading two different AJAX requests on two different pages
- Getting the post terms ‘wp_get_post_terms’ per post when within the functions.php file
- How to load a script code only in posts?
- Multiple meta_key ordering with pre_get_posts
- How do I fit WP_Query arguments into a function?
- Create a notification for post field
- Add URL Rewrite Rule To WordPress
- Trying to get property of non-object in: $wp_query
- WordPress dynamic AJAX query
- relation OR instead of AND – Filtered term ID’s in loop
- Pagination repeating posts on search results
- How to check if logged in user have pending custom post?
- Custom WordPress post query for displaying time-released content on website
- SEARCH QUERY PLEASE HELP | call_user_func_array() expects parameter 1 to be a valid callback php
- Custom query for custom post type not getting correct post ID
- Finding post ID dynamically on click
- how to move a page from one drop down menu to another drop down menu
- How to upload 3 attachments to current post?
- Global page ID variable empty error
- WP_Query & shortcode : Return 3 articles from a category WordPress
- Get post Number with local loop and template
- Save query in function for custom gallery
- Seach and categories not working when ignoring sticky posts in main loop
- Problem with custom WP_Query and underlying pagination/posts_per_page
- Calling a function with WP_Query only ever brings the first result
- What argument does my function need to echo get_results() query results
- Fetching $_POST from Page Template into functions.php
- Declare inline background image in functions.php
- I wan to process the following js to process the AJAX Request on my function to calculate author Total Post views
- Hiding all posts/products/pages from a site based on a custom taxonomy/domain name
- ordering and optimizing functions
- Why WP_Query in functions.php is not working when get_posts works?
- Adding css tweak based on page template
- WP_Query and DES sort for Custom Taxonomy based upon a meta field?
- How to write a query-function as a query-shortcode?
- 1500+ duplicate queries via get_option function (query monitor)
- Variations as Single Products [closed]
- Excluding a category from frontpage but not from WP_Query
- Order by DESC, ASC in custom WP_Query
- Exclude or Include category ids in WP_Query
- Changing the meta_query of the main query based on custom query_vars and using pre_get_posts
- Query Posts in a Predefined Order
- Order by meta_value_num DESC and meta_value ASC on WP 4.0
- How can I style future post?
- List taxonomy terms plus their latest post ordered by post date
- WordPress documentation – WP_Query arguments
- WP_Query with multiple meta fields filter?
- WP_Query Date Query After Minus Hour AND minus minutes
- How to select events within current week using wp_query
- Fetch Record based on meta key dates
- How can I display list of all posts from a specific author, with publish dates in the future, on an author archive page (author.php)?
- Custom posts visible in admin, but truncate in public
- Why does get_posts only show results for Admins or logged-out users?
- Limiting number of related posts
- Pagination works in custom query loop but it doesn’t work in shortcode
- WP_Query | IF within $args array | Help me only add specific arguments if the argument is not blank
- How to avoid filling up an array each time I run a WP_query?
- How to SQL query posts IDs by categories AND authors?
- wp query remove posts from query then update max pages and posts found
- Custom Form / Search with Custom Post Type Data
- Combine relationship posts with existing wp_query
- What is the equivalent WP_Query of a SQL Query?
- create custom shortcode wp and put php code in
- How to get only present and past posts with post_date
- Wrote a WP Cron Plugin and it triggers a fatal error upon activation
- How can I get taxonomy term name using term slug & post ID using build in WordPress function or class?
- Filters do not work when there are multiple (one works)