How to filter content post only on save

Look at ‘save_post’ and Post Status Transitions. save_post is an action triggered whenever a post or page is created or updated, which could be from an import, post/page edit form, xmlrpc, or post by email. The data for the post is stored in $_POST, $_GET or the global $post_data, depending on how the post was … Read more

Prevent CSS/JS loading when plugin is not used

You need to use action wp_enqueue_scripts except wp_head like: function inf_remove_junk() { if (!is_admin()) { wp_dequeue_style(‘js_composer_front’); wp_dequeue_style(‘js_composer_custom_css’); wp_dequeue_script(‘wpb_composer_front_js’); } } add_action( ‘wp_enqueue_scripts’, ‘inf_remove_junk’ ); But it remove the scripts from front end. I think on archive pages VC does not execute it’s shortcode. So you can check is_archive() condition instead of is_admin(). Or you can … Read more

Multiple Domains with Single WordPress Install

Why not multisite: Multisite installations are difficult to maintain compared to single site installations. Many useful plugins don’t work properly on multisite installations. There may be SEO concern for such short web sites with basically just one page (thank you page doesn’t count) that looks very similar from the names. Multisite won’t solve this probable … Read more

Sub menu with a URL parameter and access the page

I have checked your code. You are using incorrect menu-slug in add_submenu_page. Because admin already has page query var which conflicts with your menu slug page=settings&submenu=page2. I have updated the code. add_menu_page( ‘Main Menu’, ‘Main Menu Titlw’, $min_access_cap, ‘main-main’, array($this, ‘main_menu’), $icon_url, 999 ); add_submenu_page( ‘main-menu’, sprintf( __( ‘%1$s ‹ %2$s’, ‘main-menu’ ), $title[‘page_title’], ‘Submenu’ … Read more

Remove action from woocommerce barcode plugin [closed]

You need to access the class variable to remove a action which has been added within a class function remove_default_order_barcode(){ global $WooCommerce_Order_Barcodes ; remove_action( ‘woocommerce_order_details_after_order_table’, array( $WooCommerce_Order_Barcodes, ‘get_display_barcode’ ), 1, 1 ); } add_action(‘init’,’remove_default_order_barcode’); hope it will help you !

REST-API: extend media-endpoint

I found the solution for my problem. The object type for media is not media, it’s just attachment. So the following code works for me: <?php /** * Plugin Name: REST Response Modifier * Description: A simple plugin to modify the rest api * Author: TheBalco * Author URI: http://somepage.dev */ add_action(‘rest_api_init’, ‘tb_add_custom_rest_fields’); function tb_add_custom_rest_fields() … Read more