this comes down to a simple one line and there is no need to get all of the children using:
$featured image_id = get_post_meta( $post_id, '_thumbnail_id', true );
Related Posts:
- How might I retrieve a featured post image from an external WP site and display it as a link back?
- Delete all post meta except featured image
- Does thumbnail regeneration edit the database?
- Size article thumbnails and retrieve them directly from database
- Delete all post meta except featured image Using SQL
- How to update the values when the featured image has changed?
- add featured image dialog box disappear
- mySQL database size large, but tables size less
- Store the wordpress “featured image” under »wp_posts« Database table
- featured image not showing up with mysql_connect
- How to resolve ORA-011033: ORACLE initialization or shutdown in progress
- Oracle SQL query for Date format
- Failed to connect to mysql at 127.0.0.1:3306 with user root access denied for user ‘root’@’localhost'(using password:YES)
- Can I have multiple primary keys in a single table?
- get_results using wpdb
- Database connection close
- How to create bulk page and content? [closed]
- Importing posts from old website to new conflicting post ID’s?
- Transient RSS feeds in wp_options not removed automatically?
- Best way to move live site local
- The revisions table in my database is at 70% capacity and growing. What should I do?
- WordPress for a very large website
- How best to inject ads between posts in the loop?
- Cloning and syncing a WordPress website
- How to execute mulitple statement SQL queries using $wpdb->query?
- Store and Encrypt Contact Form 7 Submissions in Database? [closed]
- WordPress database growing dramatically in size despite adding no new content
- Clean database from unused tables
- How wordpress accesses its own database
- Using table lock with wp_insert_post?
- Migrating database / content of non-CMS site to WordPress
- Should I remove transients from the wp_options table?
- How do I find which articles are missing a featured image in The WordPress database?
- Show last modified date of database
- Are custom tables in the database overwritten when WordPress is updated to new versions?
- What generates these very slow postmeta queries? [closed]
- How to migrate a website based on a custom database to wordpress?
- How to scan barcode and store data into a database [closed]
- Fetching values from database for select box
- WP CLI Core install – blank database
- Update from 4.5 to 4.6 failing
- fastest replacement DB
- Call to undefined function get_user_meta() – trying to access data in MySQL from custom fields
- Connection refused on locahost after importing database?
- When to use custom DB tables or add_option?
- Have working sql query… trying to adjust it to use $wpdb
- Best host for running large mem and processor intensive WordPress sites?
- Will there be any concern if I upgrade my current WordPress Database server from Centos 7 Mariadb 5.5 to Centos 8 Mariadb 10.3?
- In which format the data is stored in WordPress Databases?
- creating new field on mysql
- Does WordPress store the username as a primary key in the database?
- Strange characters added to the database
- Is it possible to rebuild the website while not accesseing the original database?
- Database Update Required – Update from command-line
- After database migration, theme mods don’t show [closed]
- SQL query to set posts in bulk based on the post content
- Automate WordPress website setup with prefilled data
- Remote database connection and local development
- Custom search query by category id
- Website displays old version of page
- Image link issues after importing a database backup to my local web server
- multiple wordpress installs w/shared user database but separate content databases
- Updating seperate database when post attachment is changed
- Displaying table data on a page
- muliple wordpress installs (network) on different databases
- WordPress Database – wp_usermeta and the correct number of session_tokens rows
- How to get a list of articles related to a particular category from my other WordPress website?
- Whats the best practise on how to store json data from a custom settings page?
- /wp-admin not accessible after migrating to local host (no plugin issue)
- Job and Employee Performance Tracking with Product Safety
- set_transient fails if the value has more than 60.000 characters
- A WP dev site that displays content from a live site’s database but cannot write to wp_posts?
- error establishing database connection (WAMP + filezilla)
- Is there a way for two deferent themes to consume two different DB on a same WP instance?
- Set SQL_BIG_SELECTS and MAX_JOIN_SIZE on a WP_Query
- How to optimize wp_option table?
- How do I update a WordPress wp_postmeta meta_value that contains many options
- How can I get $wpdb to show MySQL warnings?
- About wp database hooks (error establishing connection)
- Database for JQuery Autocomplete field
- How to extract some part of WordPress full source code
- Create Tables in WordPress
- Catchable fatal error in formatting.php
- Wrong url for the images while using same database for two WordPress installations
- Error establishing a database connection for some files
- Hash user emails in database?
- WordPress Failed to Login (DB Error)
- Share WordPress Database
- DB access blocked when initializing WP externally
- Saving data to database and exporting to excel
- Site does not work right, pages not showing up, even for root admin
- ERROR: “Table Prefix” must not be empty
- How do you build a database-centric site in WP?
- WordPress: Interact with Database Query Data and Login
- Attach posts based on category and position
- Getting an error when trying to migrate to DV server from Grid with Media Temple [closed]
- wp-config was suddenly updated
- Weird WP -Cli Error Connection Refused
- Order of search results based off of a backend custom field and also in alpha order
- How to find fresh (last modified) and sql backup?