Forums

TDO Mini Forms
Conditionnal function for TDO Mini Forms (1 post)

  1. evo252
    Member
    Posted 1 year ago #

    Hello!

    I have this function in a plugin, which transform automatically an embed youtube video into a custom field :

    function find_ytid($postID, $post) {
    if($parent_id = wp_is_post_revision($postID))
    {
    $postID = $parent_id;
    }
    $content = $_POST['content'];
    if (preg_match(‘/http:\/\/www.youtube\.com\/v\/([a-zA-Z0-9\-\_]{11})/’, $content, $yturl) !=”) {
    $ytid = substr($yturl[0], 25, 31);
    $custom = ‘http://img.youtube.com/vi/’.$ytid.’/hqdefault.jpg’;
    update_custom_meta($postID, $custom ,’ytthumb_url’);
    }

    This function runs perfectly in wordpress, but doesn’t run when a user posts an article via TDO Mini Forms (I’m obliged to edit the article in order to create automatically the custom field).

    Anyone can help me to hack this code, in order the custom field can be created automatically when a user submits content via TDO Mini Forms ?

    Thanks and sorry for my bad english.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic