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
1 Answer
Reset to default 0If 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.