Adding a H1 Tag to Post Tags automatically, but hide the tag? (Same for Category)

Create custom action in function.php, which checks current page type (if it’s category or tag page). function hidden_term_name_action() { if( is_category() || is_tag() ){ $term_id = get_queried_object_id(); $term = get_term($term_id); if($term){ echo sprintf(‘<h1 style=”display:none;”>%s</h1>’, esc_attr($term->name)); } } } add_action(‘hidden_term_name’, ‘hidden_term_name_action’); Paste this code in header.php, which fires this action and pastes term title inside hidden … Read more

How to access deleted term inside delete_product_cat action

You get 500 error, because you’ve added your filter incorrectly… It takes 4 params, but you register it as it was using only one. add_action(‘delete_product_cat’, ‘sync_cat_delete’, 10, 1); // 10 is priority, 1 is number of params to take function sync_cat_delete($term, $tt_id, $deleted_term, $object_ids){ var_dump($deleted_term); } So if you change that 1 to 4, it … Read more

related articles using shortcodes

The best way to add the shortcode is to create a shortcode in your child theme functiuons.php file. function footag_func( $atts ) { //Example return “foo = {$atts[‘foo’]}”; } add_shortcode( ‘footag’, ‘footag_func’ ); You can refer to this document for WordPress shortcodes detail https://codex.wordpress.org/Function_Reference/add_shortcode

Category list with postcount

You just need to use wp_list_categories function with param show_count set to true https://developer.wordpress.org/reference/functions/wp_list_categories/ wp_list_categories( array( ‘show_count’ => true, ‘title_li’ => ‘<h2>’ . __( ‘Categories’, ‘textdomain’ ) . ‘</h2>’) );

Redirect Changed Permalink on wordpress

I assume you have added new permalink structure by defining Custom Permalink Structure on https://yoursite.com/wp-admin/options-permalink.php and added /%category%/%postname%/ in the custom structure field. This is the WordPress default/suggested method. After this, you need to flush the old permalink structure by saving and reloading the permalink settings page. This will not work for custom post type … Read more