Send email notification when post type product is publish from pending status

You were close. The hook, you’re trying to use, is called from function wp_transition_post_status(): function wp_transition_post_status( $new_status, $old_status, $post ) { // // … // do_action( “{$new_status}_{$post->post_type}”, $post->ID, $post ); } So, to execute code when product status changes add function to hook publish_product. The first argument passed to the function is $post_id, not WP_Post … Read more

Remove distraction free mode from teeny editor

So after researching some wordpress filters i found the teeny_mce_buttons and removed the distraction free button with this function. function remove_teeny_mce_btns($buttons) { unset($buttons[13]); return $buttons; } add_filter(‘teeny_mce_buttons’, ‘remove_teeny_mce_btns’); Here is the link with the solution: https://www.gavick.com/blog/wordpress-tinymce-custom-buttons

Custom permalink structure for posts in certain categories

here is a solution to search through all categories, not only the first one. add_filter(‘post_link’, ‘custom_permalink’, 10, 2); function custom_permalink( $permalink, $post ) { // Get the categories for the post $categories = get_the_terms($post->ID, ‘category’); if (!empty($categories)) { foreach ($categories as $category) { if ($category->cat_name == “ICO”) { $cat_name = strtolower($category->cat_name); $permalink = trailingslashit( home_url(“https://wordpress.stackexchange.com/” … Read more

Link to a new page into a plugin

This work 🙂 function ca_admin_link() { // My code goes here add_menu_page( ‘Checklist Artistas’, // Title of the page ‘Checklist Artistas’, // Text to show on the menu link ‘manage_options’, // Capability requirement to see the link ‘checklist-artistas/includes/ca-checklist-acp-page.php’ // The ‘slug’ – file to display when clicking the link ); // This is the first … Read more