我有一页http://studyofjoy.com/categories/我想向标题部分添加自定义元标记,如下所示:
<meta property="og:title" content="<?php echo "title:" . $get_title_raw; ?>" />
<meta property="og:image" content="http://www.studyofjoy.com/wp-content/themes/studyofjoy/images/motivation/<?php echo $get_id; ?>.jpg" />
<meta property="og:image:width" content="500" />
<meta property="og:image:height" content="500" />
在哪里
$get_title_raw = $wp_query->query_vars[\'get_title\'];
功能。php文件如下所示:
function custom_rewrite_tag() {
add_rewrite_tag(\'%get_title%\', \'([^&]+)\');
add_rewrite_tag(\'%get_id%\', \'([^&]+)\');
}
add_action(\'init\', \'custom_rewrite_tag\', 10, 0);
function add_rewrite_rules($aRules) {
$aNewRules = array(\'categories/([^/]+)/([^/]+)/?$\' => \'index.php?pagename=categories&get_title=$matches[1]&get_id=$matches[2]\');
$aRules = $aNewRules + $aRules;
return $aRules;
}
// hook add_rewrite_rules function into rewrite_rules_array
add_filter(\'rewrite_rules_array\', \'add_rewrite_rules\');
问题是,当我将网站地址上传到facebook Scraper时,它不会加载任何信息。。。关于变量。。。我是说脸书刮痧
$get_title_raw = $wp_query->query_vars[\'get_title\'];
返回为空白或null。我们如何解决这个问题??