If you’re on wp-admin/post.php, you’ve got either
global $post_type
- or possibly
$_POST['post_type']
, if we don’t have a post ID to look up the type from
that you can test for ‘product’. See the first 50 lines of wp-admin/post.php.
As an aside, I don’t think you need to check for is_admin in a admin_init handler; nor do you need to check if your plugin is enabled if this code is in the same plugin, since it won’t be run unless the plugin is enabled. Unless you’re testing for a different plugin that is.
Related Posts:
- WooCommerce: How to edit the get_price_html
- Get woocommerce product price by id [closed]
- Woocommerce: How to remove page-title at the home/shop page but not category pages
- Hidden woocommerce products still showing up in search results [closed]
- Preventing WooCommerce email sending only on particular conditions
- Woocommerce view order link in customer emails
- WooCommerce Shop Page Not Found 404
- Filter on a custom product attribute in WooCommerce using meta_query or tax_query [closed]
- Woocommerce : How to attach an custom attachment with customer-processing-order.php email template [closed]
- Woocommerce Pre Orders – Can i override templates?
- Is is safe to edit language files from wp-content/languages/plugins/woocommerce-ro_RO?
- Does the woocommerce_order_status_changed hook fire when WooCommerce updates an order status automatically? [closed]
- Programmatically adding product attributes to WP / Woo commerce
- Woocommerce order processing email subject not changing
- Different translations for the same plugin inside a multisite
- Woocommerce multiple taxes with same rates adds as different values.
- function to add note on single Woo Commerce product page for downloadable variations
- Apply Additional Discount after coupon
- Is it possible to add a sidebar to Storefront’s Welcome page
- Set specific number of columns for top level term on product category archives
- invalid menu item when upgrading to WordPress 5.5
- Register a new user on wooCommerce using Rest API
- Woocommerce REST API allow normal users make an order
- WooComerce shows blank site (Shop)
- How to update custom field in WooCommerce
- Add product categories to receipt
- How to be able to edit custom address fields in WooCommerce admin?
- Timber, Twig, and Woocommerce: Last product stays in the cart after checkout
- Woocommerce Cart Default Language Not Changing
- Adding extra email address who receives email like admin – woocommerce
- Is it possible to merge Woocommerce attributes? [closed]
- How can i create a custom product search?
- *Woocommerce* Past Orders Disappeared after changing Stripe Account [closed]
- Need help in handling woocommerce api timeout issue [closed]
- create custom layout product list woocommerce [closed]
- Reordering product tab under product image [closed]
- How do I change the default state label for a country on the WooCommerce checkout page?
- WooCommerce Tax Filter Not Fired [closed]
- Using a filter to change a path
- Woocommerce, prevent login after registration and redirect to custom URL
- Merging updated dev site with live site while keeping orders correct
- Order with custom order status disappeared once the page is refreshed
- WooCommerce Product detail page: Add content under thumbnails [closed]
- add sub subpage endpoint to woocommerce plugin my-account section
- Show Content On below single product with specific category
- How to change a WooCommerce Subscription Deposit and Monthly Payment? [closed]
- how to change the “return to shop” button text? [closed]
- how to scrolling image on single product page
- Problem while adding the variable product woocommerce
- How do I create a filter to hide the One Click Accessibility plugin button in WordPress?
- customers are not showing up in woocommerce
- Woocommerce pre_get_posts query variation meta data not working
- Woocomerce Edit source code of form in wordpress
- Single Product Page as a Popup
- Woocommerce – Change order of products in Confirmed Order
- echo product parent category
- How to edit wc_get_template_part for archive products
- Switch to user link shortcode
- Display WooCommerce product attribute on shop page
- How to get product category ID based on post?
- Jump to Footer On Scroll – Woocommerce Pages Phones Only
- WordPress Development Workflow
- Woocommerce redirection product_name -> product_cat/product_name
- Custom account page that accepts a query parameter
- Custom WooCommerce template for product
- Checkout fr Woocommerce – load default WooCommerce checkout template on the fly
- Loop Through Current Woocommerce Product Categories Sub Categories
- why my price is not showing while adding new product?
- How to send Woocommerce Customer Details (Name, Email and Phone Number) to Admin upon signup
- Sending billing details via POST request to an API
- Two types of product categories on shop page
- Remove username and account password field from checkout page
- How to send an invoice with details to the customers
- Tax exclusive if coupon applied else tax inclusive in items
- HTTP Error when uploading pictures and problem with the size of images
- add_rewrite_rule() returns 404 page
- How to change “add to basket” button text in WooCommerce based on product category?
- Select all product woocommerce
- Woocommerce REST API: creating variations
- Woocommerce Setup not completing
- woocommerce: when adding or removing items to cart , it takes cart a few seconds to read changes?
- When to use a child theme for WooCommerce Storefront?
- WooCommerce: Bulk Quantity in Cart
- WooCommerce – Adding Product Attributes to CSV Export
- Unable to enocde the result of wc_get_products
- Remove Span Class From Woocommerce Price
- Woocommerce shows empty columns [closed]
- Product atributes in title of order (not in description)
- How to create custome pdf file of my invioice in wordpress
- Notice: Trying to get property of non-object in bodycenter [closed]
- WooCommerce remove billing detail completly
- unable to get product by category only getting product added lastly
- How to dublicate WC Product title to shortdescription field? [closed]
- Translate Woocommerce tab
- Woocommerce -> gallery images per variation without a plugin? [closed]
- Why is my WordPress admin not working
- Create bookings after subscription renewal
- Change variants URL
- Use a woocommerce hook to create a table and populate it with a query
- Woocommerce product and category in url [closed]