如何在Divi中移除文章元数据里的"by"、" | "及高亮文本?
Hey there! Let's walk through how to get rid of those unwanted parts in your Divi post meta—specifically the "by" text, " | " separators, and any highlighted text in that area. Below are a few practical methods depending on your comfort level:
Method 1: Use Divi's Built-in Customizer (Easiest First Step)
Divi has some native controls for post meta display. Start here to see if you can tweak things without code:
- Go to Divi > Theme Customizer > Blog > Post Meta
- Uncheck any meta fields you don't want to display entirely (e.g., if you don't need the author name, uncheck "Author"—this will remove the "by" text along with it)
- Note: This won't let you remove just the "by" text while keeping the author name, so if you need to keep the author but lose the "by", move to the next method.
Method 2: Custom CSS (Quick Fix for Text Removal)
Use your browser's developer tools (right-click the meta text > Inspect) to find the exact CSS selectors for your post meta elements, then add this CSS to Divi > Theme Customizer > Additional CSS:
/* Remove the "by" text before the author name */ .post-meta span.author:before { content: "" !important; } /* Hide the " | " separators between meta items */ .post-meta span.meta-sep { display: none !important; } /* Remove highlighted text in post meta (update the class to match your actual highlighted element) */ .post-meta .your-highlighted-class { display: none !important; }
Pro tip: If the "by" text isn't in a pseudo-element, you might need to use text-indent or visibility: hidden if it's part of the same element as the author name.
Method 3: Modify Meta Output via Code (Most Flexible)
For full control, use a filter to alter how Divi generates the post meta. Always use a child theme or a code snippet plugin (like Code Snippets) to add this code—never edit the parent Divi theme files directly:
// Remove the "by" text from author meta add_filter('et_post_meta_author', 'custom_remove_by_text'); function custom_remove_by_text($author_html) { return str_replace('by ', '', $author_html); } // Remove the " | " separator between meta items add_filter('et_post_meta_separator', 'custom_remove_meta_separator'); function custom_remove_meta_separator($separator) { return ''; } // Remove highlighted text from post meta (adjust the regex to match your highlighted element's HTML) add_filter('et_post_meta_content', 'custom_remove_highlighted_meta_text'); function custom_remove_highlighted_meta_text($meta_html) { // Replace this regex with the actual HTML structure of your highlighted text return preg_replace('/<span class="highlight">.*?<\/span>/', '', $meta_html); }
This code hooks into Divi's existing meta filters to strip out the exact content you don't want.
Method 4: Build a Custom Post Template with Divi Builder
If you're using Divi Builder for your posts:
- Edit your post (or create a global post template via Divi > Theme Builder)
- Remove the default Post Meta module, or add a custom one
- Configure the custom module to only include the meta fields you want, without the "by" text or separators
- For highlighted text, simply don't add that content to the module.
内容的提问来源于stack exchange,提问作者Noor Khan

