如何移除WooCommerce商品页面的发布日期与作者信息?
Hey there! Let's figure out how to get rid of that post date and author info showing up above your WooCommerce products in the Better Health theme. Here are a few solid methods to try, ranging from no-code to more advanced options:
1. Check for Built-in Theme Settings (Easiest First Step)
First things first—many modern themes (including Canyon Themes' Better Health) let you toggle meta info like dates and authors right from the customizer. Here's how to check:
- Head to your WordPress dashboard, go to Appearance > Customize
- Look for sections related to WooCommerce or single product layouts—maybe something like Single Product Settings or Meta Information
- Scan for toggles labeled "Show Post Date" or "Show Author" and flip them off. Save your changes and refresh a product page to see if that works.
2. Hide with Custom CSS (No-Code, Safe)
If the theme doesn't have built-in controls, custom CSS is a quick fix. No need to mess with theme files:
- Go to Appearance > Customize > Additional CSS
- Paste one of these code snippets (try the first one first; if it doesn't work, use the second):
/* Hide entire meta section (date + author) on product pages */ .single-product .entry-meta { display: none !important; }
Or if you need to target specific elements:
/* Hide only date and author individually on product pages */ .single-product .post-meta-date, .single-product .post-meta-author { display: none !important; }
- Click "Publish" and clear your browser cache to see the changes. If these selectors don't hit the mark, use your browser's dev tools (F12) to inspect the date/author elements and grab their exact class names to replace in the code.
3. Modify Template Files (Advanced, Use a Child Theme)
For a more permanent solution (that won't break when you update the theme), use a child theme to edit the product template:
- First, create and activate a child theme for Better Health (this is critical—never edit the parent theme directly!)
- Locate the template file that outputs the meta info. This might be
single-product.phpin the theme root, or a file inwoocommerce/single-product/(if the theme overrides WooCommerce templates), or evencontent-single-product.php - Find the code block that displays the date and author—look for lines like
<?php the_date(); ?>or<?php the_author(); ?>, or a function that outputs the full meta section - Comment out or delete those lines, then save the file and upload it to your child theme's corresponding directory (mirror the parent theme's file structure)
4. Use a Code Snippet Plugin (No Child Theme Needed)
If you're comfortable with a little PHP but don't want to set up a child theme, use a plugin like Code Snippets to add a custom function:
- Install and activate the Code Snippets plugin
- Go to Snippets > Add New
- Paste this code:
// Remove date and author meta from WooCommerce single product pages function remove_product_date_author_meta() { // Remove WooCommerce default meta section remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_meta', 40 ); // If the theme adds its own meta, you might need to find the corresponding action hook to remove here } add_action( 'init', 'remove_product_date_author_meta' );
- Name the snippet something like "Remove Product Meta Info", click "Save and Activate", then check your product pages.
A quick note: Always test changes on a staging site first if you can, and clear your browser/caching plugin cache after making changes to see the updates.
内容的提问来源于stack exchange,提问作者DLozinski

