在wordpress中,我使用do_shortcode调用联系人表单7插件中的一个表单,如下所示
echo do_shortcode( '[contact-form-7 id="9866"]' );
如何将回调函数设置为此?
发布于 2015-10-22 12:42:52
不存在do_shortcode()的回调函数。如果需要在之后直接调用函数,只需直接调用它。例如:
echo do_shortcode( '[contact-form-7 id="9866"]' );
some_custom_function();如果您需要使用returned值do_shortcode()来做一些事情……在准备好之前不要使用echo:
$shortcode_contents = do_shortcode( '[contact-form-7 id="9866"]' );
$altered_contents = alter_shortcode_contents_function( $shortcode_contents );
echo $altered_contents;https://stackoverflow.com/questions/33281238
复制相似问题