admin管理员组文章数量:1122846
I'm working on a project where I use WordPress admin hooked up with Laravel. I use WP to edit and create posts and Laravel to query the database. I also use shortcodes.
Is it possible to call the do_shortcode() function when saving post content so that the "compiled" version goes into the database and not the shortcode version?
I'm working on a project where I use WordPress admin hooked up with Laravel. I use WP to edit and create posts and Laravel to query the database. I also use shortcodes.
Is it possible to call the do_shortcode() function when saving post content so that the "compiled" version goes into the database and not the shortcode version?
Share Improve this question asked Apr 16, 2015 at 12:50 TamásTamás 1333 bronze badges1 Answer
Reset to default 0So I found my answer in the codex.
content_save_pre() is my friend. Here is the usage:
function my_sanitize_content( $content ) {
return do_shortcode($content);
}
add_filter( 'content_save_pre' , 'my_sanitize_content' , 10, 1);
Haven't tried it yet, it should work I suppose.
本文标签: shortcodeSaving post content to database with doshortcode
版权声明:本文标题:shortcode - Saving post content to database with do_shortcode? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736298955a1930339.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论