• function updatelink($id) {

    preg_match('#See the link <a href=(.*)>#', $_POST['content'], $rect);

    $current = get_post_meta($id, 'link');

    if (!isset($current) || (sizeof($current)==0)) {
    add_post_meta($id, 'link', $rect[1]);
    }
    else {
    update_post_meta($id, 'link', $rect[1]);
    }
    }

    add_action('save_post', 'updatersslink');

    i would capture a link when post is saved….but the preg match didn’t work good.

    if i use in preg_match “a href=(.*)>” i capture the link with \”…if i use “a href=\”(.*)\”>” the script doesn’t capture anything…

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

    (@marcomail)

    Now it works, how can i return the content of the meta data in the wp loop, i try to use return in the bottom of the function but did’nt return anything….

    function updatersslink() {

    global $post;

    preg_match('#Original link <a href="(.*)">#', $post->post_content, $rect);

    $current = get_post_meta($post->ID, 'rsslink');

    if (!isset($current) || (sizeof($current)==0)) {
    add_post_meta($post->ID, 'rsslink', $rect[1]);
    }
    else {
    update_post_meta($post->ID, 'rsslink', $rect[1]);
    }
    }

    return 'sda79fa7fdfa95taf' ;

    ?>

Viewing 1 replies (of 1 total)
  • The topic ‘why this plugin doesn’t work ???’ is closed to new replies.