Reference Link: https://developers.elementor.com/custom-query-filter/#Using_the_Custom_Filter
arbitrary_name_query_id – the QUERY ID that you fill in the Elementor field,
the code to be placed within functions.php:
add_action( 'elementor/query/arbitrary_name_query_id', function( $query ) {
$meta_query = $query->get( 'meta_query' );
$meta_query[] = [
'key' => 'acf_key', // put ACF relationship field name
'value' => get_the_ID(),
'compare' => '=',
];
$query->set( 'meta_query', $meta_query );
$query->set( 'post_type', 'post_type' ); // put post type name
});
Related Posts:
- Getting custom taxonomy from custom post type
- Filter next_post_link() and previous_post_link() by meta_key?
- Automatically fill custom field value on post publish/update
- Make permalinks based on an ACF-field
- How to sort a table of custom posts by column containing custom field
- List events by month
- Use Custom Post Type as Custom Field
- Pull image from ACF field in a Custom Post Type
- Archive filter disappears on no results?
- Show ACF field from custom taxonomy and display on the single template
- WordPress custom post type archive with description
- wp_update_post based function works on existing posts, but not new posts
- How to Display ACF Relationship Custom Field as Link to Specific Custom Post?
- How to replace custom post type slug with an ACF value?
- Link users to a custom post type
- How to display Custom Post Type Post based on Tag with Shortcode Parameter?
- Validate custom fields before save using WordPress Rest API
- How can I dynamically add a post to a custom post type which uses a custom field?
- Problem with WordPress query on page using custom fields
- Custom Taxonomy terms aren’t getting referenced or saved in Quick Edit or Bulk Edit, only on Single product page?
- Troubles with acf/save_post and WP_Query
- Query custom post type with ACF Date
- custom post type WYSIWG removes paragraphs when displayed
- ACF From & To Date Validations
- Using advanced custom fields from one custom post type in another custom post type / using nested shortcodes
- Exclude objects from WordPress API based from ACF field using rest_prepare_{$post_type}
- CPT archive admin menu label
- Rewrite Rule for showing Parent/Child Relationship between Two Hierarchical Custom Post Types
- Order Custom Post Type by Custom Field Value
- Lists custom taxonomy terms that has specific custom field value assigned to the term (not post)
- How to update post meta on uploaded image from a custom form?
- Order post by date with ACF
- How to set the seo title tag on a page by page basis?
- How to add/edit advanced custom fields on custom post type’s WordPress REST API?
- Querying & displaying custom post type into an existent page [closed]
- Custom post type showing same Post on all Pages
- Post loop count is not in order
- How to inherit field value from parent post into in child / sub post
- Custom Post Type page sorts differently on different environments
- How to use single.php for creating, reading and editing Custom Posts with ACF
- posttype and custom fields on multisite
- Custom fields not showing in custom post type
- Group by custom field value (start and end times)
- wp-includes does not contain a feed template
- Using WP meta query to show custom post types by a start and finish date
- Advanced custom field – posted fields from custom post type
- How to display author details in a custom post type in the wordpress backend?
- Show/hide posts and categories based on user meta
- Fetch data from two custom post types and create multidimensional array for output to html table
- Having a repeating custom field in admin custom post type, what I’d go better with, for DB’s sake? ACF repeater or query a different post type?
- ACF – Retrieve custom taxonomy from a relationship field
- Custom front-end form for adding post – Category problem
- Set up a WP Cron scheduled event to update calculated ACF field
- Query filter by value in meta_value array
- Show Post Revisions on front-end
- How to show Custom Post Type – Case Study using Shortcode & ACF
- Add custom post related by custom field to custom post
- Create loop from selected terms in ACF taxonomy field
- Sort custom posts by date and then by taxonomy
- Custom post ID & display information related to this ID
- Expire post to draft by date-picker custom field
- Show custom post type event if current day using ACF
- WP_Query not using custom taxonomy categories on custom post type
- How would i insert a value of custom field from Advaced Custom Field into shortcode generated by Gravity Forms [closed]
- Issue to display Permalink (ACF Relationships in Custom Post Type )
- Auto generate excerpt from ACF field on a CPT that does not support excerpt or content
- Custom post type not pulling CSS
- Button link display in shortcodes using custom field in ACF
- How do I link to a dynamic ACF button from a Custom Post type?
- Changing default admin column sorting to an ACF Date Picker field
- Taxonomy shows up twice on Custom Post Type
- How to hide sub fields in a field group and also the entire field group if the answer selected is “no”
- Create 3 Levels of relations with WordPress
- Wrapping an unknown amount of posts inside separate HTML Containers during WP_Query loop
- Linking posts together with Advanced Custom Fields “both ways”
- save_post affect creation and deletion
- How can I save a Custom Post Title and Slug with a Custom Field?
- Custom permalink rewrite rules – how do I fix this?
- Custom Field as Custom Post type element class
- Extracting Post ID and passing through as an attribute in a shortcode
- Automatically convert standard posts with custom fields to custom post types
- Submit and edit font end custom post type
- How to make a custom search template for custom taxonomy?
- Making my custom column sortable
- Get month and day from a Date Picker custom field
- How to query posts by meta keys AND under specific category?
- how to load custom single.php?
- Setting a custom $query->query_vars[‘meta_key’] breaks the WordPress menu
- Function that get ACF fields value before saving
- Modifying and Displaying URL’s in a Post Template using parse_url
- Custom post type adding additional markup
- Advanced Custom Fields: query posts filtered by multiple field values
- Custom Post-type not returning the right child_of
- Register a title automatically with a relationship field
- WooCommerce – Complete Order when an action occurs
- WordPress Loop trouble with ACF [closed]
- Display ACF object field data using Elementor Custom Query
- ACF Pro simple Business Directory – Requesting assistance with created Templates and associated Functions.php Coding
- Advanced Custom Fields Custom Post Types Heirarchy
- Generate Post Title From ACF Fields on Custom Post Type