function my_update_meta2($post_id) {
$posttags = get_the_tags();
$count=0;
if ($posttags) {
foreach($posttags as $tag) {
$count++;
if (1 == $count) {
$key = 'tagname';
$value = $tag->name . ' ';
update_post_meta($post_id, $key, $value);
}
}
}
}
add_action('save_post', 'my_update_meta2');
add_shortcode( 'get-table', array( 'CMTOC_Pro', 'getTableOfContentsContent' ) );
/**
* Returns TRUE if the shortcode was found
* @staticvar boolean $found
* @param type $setFound
* @return type
*/
public static function wasShortcodeFound($setFound = FALSE)
{
static $found = FALSE;
if( $setFound )
{
$found = $setFound;
}
return $found;
}
/**
* Display the table-of-contents
* @param type $atts
* @param type $text
* @return type
*/
public static function displayTableOfContentsShortcode($atts = array(), $text = '')
{
$tableOfContentsContent = '';
/*
* Only show once
*/
if( !self::wasShortcodeFound() )
{
$tableOfContentsContent = self::getTableOfContentsContent();
self::wasShortcodeFound(TRUE);
}
return $tableOfContentsContent;
}
/**
* Outputs the table of content
* @param type $content
* @return string
*/
public static function outputTableOfContents($content)
{
$contentWithTableOfContents = do_shortcode($content);
$shortcodeWasFound = self::wasShortcodeFound();
if( !$shortcodeWasFound )
{
$tableOfContentsContent = self::getTableOfContentsContent();
self::wasShortcodeFound(TRUE);
$contentWithTableOfContents = $tableOfContentsContent . $contentWithTableOfContents;
}
return $contentWithTableOfContents;
}
$code = array($data['post_title'], $data['post_content']);
$code = str_replace('a', 'b', $code);
//We add the video
$newVideoId = wp_insert_post( $newVideo );
if( $service == 'youtube' )
update_post_meta( $newVideoId , 'wpvr_video_ytId' , $new_video_id );
elseif( $service == 'dailymotion' )
update_post_meta( $newVideoId , 'wpvr_video_dmId' , $new_video_id );
elseif( $service == 'vimeo' )
update_post_meta( $newVideoId , 'wpvr_video_voId' , $new_video_id );
для add_action я в этой функции добавлял ещё так:
add_action( 'acf/save_post', 'save_Video_Post');
но не помогло