Custom Fields
Re-Envisioned
Support MB Settings Page Use post field with meta_query

This topic contains 1 reply, has 2 voices, and was last updated by  Anh Tran 5 days, 7 hours ago.

  • Creator
    Topic
  • #16853

    Infolu
    Participant

    Hello, how can I use the post field to look up words in a specific key instead of just title
    (meta_query = key )

    
    // Register meta boxes and fields for settings page
    add_filter( 'rwmb_meta_boxes', function ( $meta_boxes ) {
        $meta_boxes[] = array(
            'id'             => 'general',
            'title'          => 'Default Domain',
            'settings_pages' => 'ims-core-trades-settings-domain',
            'tab'            => 'general',
            'fields' => array(
                array(
                    'id' => 'url_1',
                    'type' => 'url',
                    'name' => esc_html__( 'URL', 'metabox-online-generator' ),
                ),
                array(
                    'id' => 'post_2',
                    'type' => 'post',
                    'name' => esc_html__( 'Post', 'metabox-online-generator' ),
                    'post_type' => 'domain',
                    'field_type' => 'select_advanced',
                    'query_args'  => array(
                        'post_status'    => 'publish',
                        'posts_per_page' => - 1,
    
                        'meta_query' => array(
                            'relation' => 'AND',
                              array(
                             'key' => 'domain_mf_default_url',
                             'value' => searched word,<-----------
                             'compare' => '=',
                             ),
                         
                         )
    
                    ),
                ),
            ),
        );
        return $meta_boxes;
    } );
    
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.