forms - woocommerce hook on page-new.php -
i'm using woocommerce , mgates vendor software while adding hooks on page-new.php page make instructions vendors on add product page. i'm using
add_action( 'edit_form_after_title', 'myprefix_edit_form_after_title' ); function myprefix_edit_form_after_title() { echo 'this text!'; }
as after editor , form advanced
on add product page have:
title
'edit_form_after_title'
description
'edit_form_after_editor'
product short description
- how figure out hook put between these sections?
product data
how or put these hooks have them them show on add products post page , not ever post page?
you can fire hook selectively using:
add_action( 'load-post-new.php', 'your_callback' );
and check post type before adding hook:
function your_callback() { global $typenow; if( 'product' != $typenow ) return; add_action( 'edit_form_after_title', 'myprefix_edit_form_after_title' ); }
or, option:
add_action( 'edit_form_after_title', 'myprefix_edit_form_after_title' ); function myprefix_edit_form_after_title() { global $pagenow, $typenow; if( 'post-new.php' != $pagenow || 'product' != $typenow ) return; echo 'this text!'; }
Comments
Post a Comment