yoast造成php内存,php – Yoast SEO |如何创建自定义变量
你有兩種選擇.
>為更改存在變量添加過濾器.
>添加新的自定義變量.
如果要更改存在的變量,可以這樣做:
// define the wpseo_replacements callback
function filter_wpseo_replacements( $replacements ) {
if( isset( $replacements['%%page%%'] ) ){
$replacements['%%page%%'] = 'Page x of y';
}
return $replacements;
};
// Add filter
add_filter( 'wpseo_replacements', 'filter_wpseo_replacements', 10, 1 );
如果你想添加自定義變量,你可以這樣做:
// define the custom replacement callback
function get_myname() {
return 'My name is Moses';
}
// define the action for register yoast_variable replacments
function register_custom_yoast_variables() {
wpseo_register_var_replacement( '%%myname%%', 'get_myname', 'advanced', 'some help text' );
}
// Add action
add_action('wpseo_register_extra_replacements', 'register_custom_yoast_variables');
我希望我對你有所幫助.
與50位技術專家面對面20年技術見證,附贈技術全景圖總結
以上是生活随笔為你收集整理的yoast造成php内存,php – Yoast SEO |如何创建自定义变量的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: php阻止form提交表单提交,防止表单
- 下一篇: php post cmd,[转载]?ph