A dire il vero è una funzione di wordpress, quando salvi un articolo lui cerca l'url e lo memorizza nel database, però non riesco a fargli accettare i doppi apici, quando li inserisco non mi inserisce nessuna stringa sul db:
Codice PHP:
function updatersslink($id) {
$current = get_post_meta($id, 'rsslink');
if (!isset($current) || (sizeof($current)==0)) {
//prepare the content
// $article = strip_tags($post->post_content);
preg_match("#Visit the <a href=(.*)>link</a>#", $_POST['content'], $rect);
$meta_exists=update_post_meta($id, 'rsslink', $rect[1]);
if(!$meta_exists) {
add_post_meta($id, 'rsslink', $rect[1]);
}
}
}
// whenever the post is edited, published or saved, refresh the tags
add_action('edit_post', 'updatersslink');
add_action('publish_post', 'updatersslink');
add_action('save_post', 'updatersslink');{