• Resolved deancs

    (@deancs)


    Hi Jamie,

    It seems code and/or strings are being filtered by the built in WordPress filters. I have PHP array which includes a string that is a youtube video URL eg

    https://www.youtube.com/watch?v=Hz9LA2czQng

    I wanted to extract just the video id (Hz9LA2czQng) with the following code

    $videoid = substr($video['url'],strpos($video['url'],"=")+1);

    I was getting strange results and discovered the url have been replaced with oembed iframe

    Do you know any way to stop the standard WP filters being applied ?

    Thanks, Dean

    https://ww.wp.xz.cn/plugins/php-code-for-posts/

Viewing 1 replies (of 1 total)
  • Thread Starter deancs

    (@deancs)

    Resolved – I was using ACF get_fields() which returns an array of all custom fields.

    WordPress was processing the array and expanding youtube URLs to full iframe oembeds.

    The ACF get_field() (single field) has a second parameter which if set to default disables formatting. Although not documented this parameter also works for ACF get_fields()

Viewing 1 replies (of 1 total)

The topic ‘Code being manipulated by wordpress filters – oembed’ is closed to new replies.