【发布时间】:2020-08-25 11:05:41
【问题描述】:
我创建了一个从页面中提取标签列表的插件。如果我将它作为简码加载,它可以正常工作,如果我将它作为带有 add_action 的插件中的函数加载,它会返回 nada!有什么想法吗?
add_action( 'init', 'something_helper' );
function something_helper()
{
echo "the tags are: ".the_tags(); //returns nothing
}
或者
function somefunction()
{
echo "the tags are: ".the_tags(); //returns tag list
}
add_shortcode( 'shortcode_name', 'somefunction' );
【问题讨论】: