Support

Account

Home Forums General Issues ACF with plugin YouTube LYTE

Solving

ACF with plugin YouTube LYTE

  • I need to apply WP YouTube Lyte . It works in native field of WP. But not in custom field.
    Author in a support page say to use acf/format_value .
    Is it possible works use ACF with YouTuve LYTE?

    Thanks

  • Hi @venenum

    Based on the plugin author’s answers, it should be working. You can use a text custom field to input the link and then try this code in your functions.php:

    For ACF v5.

    function my_acf_format_value_v5( $value, $post_id, $field ) {
    	
    	$value = lyte_parse($value);
    	return $value;
    }
    
    add_filter('acf/format_value/name=field_name', 'my_acf_format_value_v5', 10, 3);

    For ACF v4 (free version).

    function my_acf_format_value_v4( $value, $post_id, $field ) {
    
    	if($field['name'] == 'field_name'){
            $value = lyte_parse($value);
        }
    	return $value;
    }
    
    add_filter('acf/format_value_for_api', 'my_acf_format_value_v4', 10, 3);

    Please change the “field_name” with your custom field name.

    I hope this helps!

  • Hi there,

    Apologies for bringing an old thread up, but I too need to use YouTube Lyte with ACF. My problem is that the custom field type I have used for the videos is ‘oembed’ and it is mentioned above it should be ‘text’. Is there any way of making it work with the ‘oembed’ type?
    I checked with the YouTube Lyte devs, but they sent me here.

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘ACF with plugin YouTube LYTE’ is closed to new replies.