If I understand the question you are trying to show both post on single.php something like this should work as a second loop.
Put This INSIDE the first loop. Do this so you can get the current post ID
$parent_id=the_ID();
// Second Loop
$query = new WP_Query( array ( 'post_type' => 'TYPE1', 'meta_key' => $parent_id ) );
while ( $query->have_posts() ) : $query->the_post();
//normal loop stuff such as the_content();
echo '<li>';
the_title();
echo '</li>';
endwhile;
Related Posts:
- Triple meta_key on custom SELECT query
- Lack of composite indexes for meta tables
- Safe to delete blank postmeta?
- How to get all term meta for a taxonomy – getting term_meta for taxonomy
- delete unused postmeta
- Short of raw SQL, can I query for multiple attachment metadata that have a given array key?
- Get updated post meta on save_post action?
- How to get the total number of meta_values based on a custom post type?
- Insert post metadata for all posts in CPT at once if metadata no existent
- Set Condition echo function get_post_meta
- Get a row from a separate table by matching a posts meta_key to a tables ID column
- Compare string with post id in wpdb and do stuff when match is found
- Which is faster wpdb & get_row or wp_query & ge_post_meta?
- Read post meta values, only if posts are public
- How to test the outcome of a wpdb query?
- How to delete duplicate records in wp_postmeta database table?
- wpdb->get_var – count author posts, meta value
- How to query and update one colum in postmeta table?
- Display current ranking of post as a number in post title
- get specific values from WordPress meta_value
- Get data from custom table and update relative post_meta based on meta_key
- “BS_” rows in postmeta table
- why is my postmeta table is so heavy
- Get table parameter and save in meta value
- Display multiple meta_key/meta_values by single SQL query
- Exclude category from DB query
- Fetching array of postmeta with $wpdb and in_array conditional
- Which query method to use? (edit- wpdb syntax problems)
- Using mysql queries to delete custom post types based on meta_value
- Cache metadata for set of posts
- Export posts with postmeta without ID?
- How to get all the related ids without array?
- How do I retrieve the slug of the current page?
- Using wpdb to connect to a separate database
- How do you properly prepare a %LIKE% SQL statement?
- Most efficient way to get posts with postmeta
- Get posts by meta value
- Should I use wpdb prepare?
- Explanation of update_post_(meta/term)_cache
- How to extract data from a post meta serialized array?
- How to return number of found rows from SELECT query
- How to save an array with one metakey in postmeta?
- WordPress is stripping escape backslashes from JSON strings in post_meta
- How can I get the post ID from a WP_Query loop?
- Why are simple updates to wp_postmeta’s “_edit_lock” so slow?
- Check if Post Title exists, Insert post if doesn’t, Add Incremental # to Meta if does
- Return only Count from a wp_query request?
- Use REGEXP in WP_Query meta_query key
- How to fetch Data in WordPress using MySQLi or $wpdb
- How to update_post_meta value as array
- Adding meta tag without plugin
- What’s the point of get_post_meta’s $single param?
- What is the different between an attachment in wp_posts and an attachment in wp_postmeta?
- wpdb->insert multiple record at once
- How to edit a post meta data in a Gutenberg Block?
- Can i use php sql functions instead of $wpdb?
- Sanitizing integer input for update_post_meta
- post formats – how to switch meta boxes when changing format?
- Execute action after post is saved with all related post_meta records (data)
- How to define composite keys with dbDelta()
- Get a single post by a unique meta value
- if get_post_meta is empty do something
- How we get_post_meta without post id
- How get post id from meta value
- What is the code to get the download link for a product in WooCommerce?
- So much data in postmeta
- advanced custom fields update_field for field type: Taxonomy
- $wpdb and MySQL Create Trigger
- update_post_meta not saving when value is zero
- find a random blogid across my multisite network that has at least one post published
- Content hooks vs User hooks
- $wpdb->delete column values IN ARRAY()?
- Meta compare with date (stored as string) not working
- Trying to get custom post meta through Jetpack JSON API [closed]
- wpdb->prepare function remove single quote for %s in SQL statment
- How to update/insert custom field(post meta) data with wordpress REST API?
- What is the advantage of the wp_options design pattern?
- Restrict post edit/delete based on user ID and custom field
- Custom query to get post names beginning with a digit
- Multipart/formatted MySQL query problem
- get_post_meta returning empty string when data shows in the database
- publish_post action hook doesn’t give post_meta_data
- Remove WordPress.org Meta link
- Remove post meta keys
- Alternative to mysql_real_escape_string
- How to access the post meta of a post that has just been published?
- Why time functions show invalid time zone when using ‘c’ time format?
- Increment value (value = value+1) of $wpdb->update
- Why is get_post_meta returning an array when I specify it as single?
- How to update/delete array in post meta value?
- Adding an assisting editor box to Post page
- Inserting Post Meta From SQL
- WPDB Multiple site’s posts and get featured images
- Search multiple meta keys at once
- Migrating non-WordPress CMS to WordPress, lots of data to move — possible solutions?
- importing data from non-wordpress mysql db
- Should I sanitize custom post meta if it is going to be escaped later?
- Get terms of posts with category with sql
- Add post meta based on another post meta value before publish post
- Why does dbDelta() not catch MysqlErrors?