如何在WordPress网站嵌入的Google地图中隐藏评论区域
Hey there! Let's tackle how to hide the reviews section in that Google Maps info box on your WordPress site. Here are a couple of reliable methods depending on how you've embedded the map:
Google Maps info boxes use specific CSS classes for different sections, including reviews. You can target that class with custom CSS to hide the reviews area entirely:
- First, identify the exact class of the reviews section: Right-click on the reviews part of the info box and select "Inspect" (Chrome/Firefox) to open developer tools. You’ll likely spot a class like
.gm-reviews-container,.gm-review-card, or.gm-review-summary(the exact name might vary slightly by map version). - Once you have the class, add this CSS to your WordPress site:
If that class doesn’t work, swap it out for the one you found in the inspector (e.g.,/* Hide Google Maps info box reviews section */ .gm-reviews-container { display: none !important; }.gm-review-summary). - To add this CSS in WordPress:
- Head to Appearance > Customize in your WP admin dashboard.
- Navigate to the Additional CSS section.
- Paste the code above and click Publish.
If you embedded the map using Google’s native embed code (not a WordPress plugin), you can add a parameter to disable reviews directly:
- When generating the embed code from Google Maps, look for the "Hide reviews and ratings" toggle in the embed settings. If you already have the code, append
&reviews=0to the end of thesrcURL. For example:
This parameter tells Google Maps to exclude the reviews section from the info box.<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3022.xxxxxx!2d-73.xxxxxx!3d40.xxxxxx!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x89c2xxxxxx%3A0xxxxxxx!2sYour+Location!5e0!3m2!1sen!2sus!4v16xxxxxxxxx!5m2!1sen!2sus&reviews=0" width="600" height="450" style="border:0;" allowfullscreen="" loading="lazy" referrerpolicy="no-referrer-when-downgrade"></iframe>
If you’re using a WordPress map plugin like WP Google Maps or Google Maps Widget, check the plugin’s settings for a built-in toggle:
- Look for sections labeled "Info Window Content", "Ratings & Reviews", or similar. Most plugins let you disable reviews in the info box with a simple checkbox, no code needed.
- For example, in WP Google Maps: Go to Maps > Edit Map > Info Window tab, then uncheck the "Show Reviews" option.
Note: Google occasionally updates their Maps API or CSS class names, so if the CSS method stops working later, just re-inspect the reviews element to find the updated class name.
内容的提问来源于stack exchange,提问作者Awadhesh Singh

