最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

debug - How to check whether functions is deprecated or not?

programmeradmin1浏览0评论

Can you please tell me if this code is up to date? Thanks in advance.

function setmot_turta_notice() {

     if ( is_product() && has_term( array('set-turta','set-mot' ), 'product_cat' ) ) {
        wc_print_notice( 'Message here!', 'notice' );    
    }
}
add_action( 'template_redirect', 'setmot_turta_notice' );

Can you please tell me if this code is up to date? Thanks in advance.

function setmot_turta_notice() {

     if ( is_product() && has_term( array('set-turta','set-mot' ), 'product_cat' ) ) {
        wc_print_notice( 'Message here!', 'notice' );    
    }
}
add_action( 'template_redirect', 'setmot_turta_notice' );
Share Improve this question edited Oct 8, 2019 at 21:07 Star Light 518 bronze badges asked Oct 4, 2019 at 14:56 John MJohn M 11 bronze badge 3
  • 1 Welcome to WPSE. What does "up to date" mean? – jdm2112 Commented Oct 4, 2019 at 17:49
  • Hey there and thanks. It's my first custom function that I made for WordPress and want to be sure that it is correctly written and if the function is not deprecated. – John M Commented Oct 4, 2019 at 19:31
  • Unless you deprecate it, its not deprecated. If you use a decent GUI like PHP Storm it will tell you if a WordPress core function is deprecated or not. If you write a function it is not deprecated unless you deprecate it. – Drmzindec Commented Oct 9, 2019 at 9:19
Add a comment  | 

1 Answer 1

Reset to default 0

If you want to develop a plugin or theme, you need a set of development toolkit. Use the Developer plugin to install debug bar and debug monitor. Those will tell you which function is deprecated if yes.

Moreover, when you develop plugin. You should read the document of WordPress and whatever plugin you are going to integrate with. It will tell you what version does functions support. Compare it with the version you want to develop with.

发布评论

评论列表(0)

  1. 暂无评论