Hook priority in admin with custom plugin

The codex entry you site is simply wrong! There are a lot of hooks fired before admin_init during admin requests, not least of which is init, which a lot of plugins use to do their initialization. In particular, the TGM Plugin Activation plugin hooks into init (with the default priority = 10) with a function … Read more

the_post hook is not firing for me

Assuming that your post_meta is being properly added, that the post in question is a real post, and that the value of ‘nb_postredirect’ is a good URL, I’d try: function nb_checkredirect( $post ) { //don’t have to use get_post_meta!* if ( $post->nb_postredirect ) { wp_redirect( $post->nb_postredirect ); exit; } } add_action( ‘the_post’, ‘nb_checkredirect’ ); Tested … Read more

Hook function prints output twice

You don’t need to add do_action(‘create_amenities’, $new_term_id);. The created_{$taxonomy} hook fires after a new term in a specific taxonomy is created by default.

(Woocommerce) Order by price when entering specific category

You can use the filter below, as suggested by @sabarnix at https://stackoverflow.com/questions/24939337/woocommerce-different-default-sorting-for-different-categories add_filter(‘woocommerce_get_catalog_ordering_args’, ‘tk_woocommerce_catalog_orderby’); function tk_woocommerce_catalog_orderby( $args ) { if( is_product_category( ‘shirts’ ) ) { $args[‘orderby’] = ‘meta_value_num’; $args[‘order’] = ‘ASC’; $args[‘meta_key’] = ‘_price’; } return $args; }