Self deactivate plugins after an action occurs

The deactivate_plugins() function is available only after the admin_init action is executed, you will either need to register ‘admin_init’ filter and run the deactivate_plugins() function there or manually include the wp-admin/includes/plugin.php file. I updated your code with the second solution below. class WP_X_Plugin{ public function __construct(){ register_activation_hook( __FILE__, array( $this , ‘activate’ ) ); $url … Read more

Add Product Subtitle to Woocommerce Product Page

This is what I have used to show the product category as a subtitle on my shop archive page add_action( ‘woocommerce_shop_loop_item_title’, ‘woocommerce_shop_loop_item_subtitle’, 20 ); function woocommerce_shop_loop_item_subtitle() { global $post, $product; $categ = $product->get_categories(); echo $categ; } and this is what I used to display it on the single product page add_action( ‘woocommerce_single_product_summary’, ‘woocommerce_single_item_subtitle’, 5 ); … Read more

Woocommerce plugin for minimum order and add-to-card-step

I think YITH Woocommerce Minimum Maximum Quantity plugin is the best solution for your purpose. It enables you to set a minimum or maximum quantity for product selection. It also shows quantity/amount error messages to your customers. Moreover, you can use the plugin to set a different minimum quantity for each of the product. So, … Read more

Getting value from Advanced Custom Fields [closed]

You are trying to use get_field_object, which isn’t correct. What you should be using is get_field() or the_field(). Example get_field(): $value = get_field( “locations” ); if( $value ) { echo $value; } else { echo ’empty’; } Example the_field(): <p><?php the_field(‘locations’); ?></p> Note: ACF has great documentation, you should look it over.

Plugin echos text from shortcode function in gutenberg page editor

As Milo noticed, shortcodes should return content instead of echoing it. So change while($query1->have_posts()) : $query1->the_post(); echo ‘<div class=”menu-thumb”>’; the_post_thumbnail( ); echo ‘</div>’; echo ‘<div class=”menu-title”>’; the_title( ); echo ‘</div>’; echo ‘<div class=”menu-content”>’; the_content( ); echo ‘</div>’; endwhile; to while($query1->have_posts()) : $query1->the_post(); $div = ‘<div class=”menu-thumb”>’; $div .= get_the_post_thumbnail( ); $div .= ‘</div>’; $div .= … Read more