Custom Field regex (2 posts)

  1. concon15
    Posted 3 years ago #


    I use the following code in function.php:

    add_filter('the_content', 'embedflash', 0);
    function embedflash(){
        $embed = get_the_content('');
        $embed = preg_replace('#\[EMB\=(.+)]#i', '<br />blablablablablablabla)
    return $embed;

    I put here the essential part of the code.
    It allows me to use a different HTML depending on the file published on the site.
    I using this code in post content:

    This code only works when I publish the file in the "content", but doesn't works with custom field. I want to insert this code into a custom field.

    How can I change that please?

    Thank you.

  2. dougvdotcom
    Posted 3 years ago #

    If you want to capture the value of a custom field, you need to use get_post_custom_values.


Topic Closed

This topic has been closed to new replies.

About this Topic