WordPress.org

Support

Support » How-To and Troubleshooting » Custom Field regex

Custom Field regex

  • Hello,

    I use the following code in function.php:

    <?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:
    [EMB=http://www.website.com/upload/file.xxx]

    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.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Custom Field regex’ is closed to new replies.
Skip to toolbar