Quantcast
Channel: Toolset » All Posts
Viewing all articles
Browse latest Browse all 20145

Reply To: [Assigned] Wrong permalink base for child posts

$
0
0

Is it correct, that "_wpcf_belongs_artist_id" is a custom field key?
So one approach would be to add this to the query like:

function wpa_filter_home_query( $query ){
    if( $query->is_main_query()
    && isset( $_GET['_wpcf_belongs_artist_id'] ) ) {
        $meta_query = array(
            array(
                'key' => '_wpcf_belongs_artist_id',
                'value' => array( $_GET['_wpcf_belongs_artist_id'] )
            )
        );
        $query->set( 'meta_query', $meta_query );
    }
}
add_action( 'pre_get_posts', 'wpa_filter_home_query' );

Doing this, my aim is still to get the correct post with "index.php?_wpcf_belongs_artist_id=24&artist=sam-sample" (24 is a sample id for the parent page) as a first step. Once this is working I can think about rewrite rules.


Viewing all articles
Browse latest Browse all 20145

Trending Articles