xmlrpc_getposttitle

函式
xmlrpc_getposttitle ( $content )
引數
  • (string) $content XMLRPC XML Request content
    Required:
返回值
  • (string) Post title
定義位置
相關方法
xmlrpc_getpostcategoryxmlrpc_removepostdataget_post_timewp_get_post_termssingle_post_title
引入
0.71
棄用
-

xmlrpc_getposttitle: 這個函式也是WordPress XML-RPC API的一部分,用來檢索一個文章的標題,由文章ID指定。

從XMLRPC的XML中獲取文章的標題。

如果標題元素不是XML的一部分,那麼將使用$post_default_title中的預設文章標題來代替。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function xmlrpc_getposttitle( $content ) {
global $post_default_title;
if ( preg_match( '/<title>(.+?)</title>/is', $content, $matchtitle ) ) {
$post_title = $matchtitle[1];
} else {
$post_title = $post_default_title;
}
return $post_title;
}
function xmlrpc_getposttitle( $content ) { global $post_default_title; if ( preg_match( '/<title>(.+?)</title>/is', $content, $matchtitle ) ) { $post_title = $matchtitle[1]; } else { $post_title = $post_default_title; } return $post_title; }
function xmlrpc_getposttitle( $content ) {
	global $post_default_title;
	if ( preg_match( '/<title>(.+?)</title>/is', $content, $matchtitle ) ) {
		$post_title = $matchtitle[1];
	} else {
		$post_title = $post_default_title;
	}
	return $post_title;
}

常見問題

FAQs
檢視更多 >