Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author stepasyuk

    (@stepasyuk)

    Hello @dimigia

    Thank you for using Filter Everything plugin.

    In general this code is too simple to make mistake in it. But I think misateke can be only one – you entered wrong value instead of ‘related_post’. Please, specify there your meta key, used for your Brand post meta (Custom) field.

    add_filter('wpc_filter_post_meta_term_name', 'wpc_custom_term_name', 10, 2);
    function wpc_custom_term_name($term_name, $e_name)
    {   // related_post - is a filter meta key name. 
        if( $e_name === 'related_post' ){
            $term_name = get_the_title( $term_name );
        }
        return $term_name;
    }
    Thread Starter dimigia

    (@dimigia)

    Hello, thanks for your answer.

    For some reason it still doesn’t work.

    I’ve tried with another CPT but it’s the same. The function is working when I replace $term_name without the if statement but the condition ( $e_name == ‘meta_key_name’ ) doesn’t work..

    • This reply was modified 3 years, 9 months ago by dimigia.
    Plugin Author stepasyuk

    (@stepasyuk)

    Ok, try please next code and let me know what data appears on the page with filters. This code should display all meta keys used in filters.

    add_filter('wpc_filter_post_meta_term_name', 'wpc_custom_term_name', 10, 2);
    function wpc_custom_term_name($term_name, $e_name)
    {   // related_post - is a filter meta key name. 
        var_dump( $e_name );
        if( $e_name === 'related_post' ){
            $term_name = get_the_title( $term_name );
        }
        return $term_name;
    }
Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Get post name instead of post id – using customfield CPT relationship’ is closed to new replies.