-
Notifications
You must be signed in to change notification settings - Fork 152
feat: Add SEO Settings module for WP User Frontend #1710
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (1)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including You can disable this status message by setting the WalkthroughAdds a new Pro-only “SEO Settings” module to the Free UI bridge: registers a pro section entry, defines preview-only settings fields (including an avoid_indexing_profiles checkbox), and extends the pro modules metadata and listing to surface the SEO module with name, description, URI, and thumbnail. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
assets/images/modules/wpuf-seo.png
is excluded by!**/*.png
📒 Files selected for processing (1)
includes/Free/Free_Loader.php
(3 hunks)
🧰 Additional context used
🪛 GitHub Check: Run PHPCS inspection
includes/Free/Free_Loader.php
[warning] 228-228:
file_get_contents() is discouraged. Use wp_remote_get() for remote URLs instead.
🔇 Additional comments (3)
includes/Free/Free_Loader.php (3)
226-232
: SEO Settings section added successfully.The new SEO Settings section is correctly implemented with appropriate labeling and pro preview styling consistent with other pro sections.
863-881
: SEO Settings configuration correctly implemented.The SEO settings section includes a logical structure with:
- User Directory SEO section header
avoid_indexing_profiles
checkbox with appropriate description explaining noindex functionality- Consistent pro preview styling and crown icon implementation
The field configuration properly explains the SEO purpose and integrates well with the existing settings structure.
1299-1304
: SEO module info correctly added to modules list.The SEO module entry is properly structured with:
- Descriptive name and description
- Documentation URI pointing to the correct wedevs.com location
- Appropriate thumbnail file reference (
wpuf-seo.png
)This follows the established pattern for other pro modules.
'thumbnail' => 'wpuf-stripe.png', | ||
], | ||
'seo/wpuf-seo.php' => [ | ||
'name' => 'SEO Settings', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Security risk: Use WordPress HTTP API instead of file_get_contents()
.
You shouldn't use file_get_contents()
for remote requests. WordPress does the heavy lifting for you when determining what is compatible on your host. Instead of file_get_contents()
use wp_remote_get()
. The issue here is that file_get_contents
will fetch remote pages but doesn't check on the integrity of the HTTPS protocol connection. This could potentially be a victim of a man-in-the-middle attack. In WordPress, it's even easier: use wp_remote_get
. It works much more consistently than file_get_contents
, and it'll default to verifying SSL connections.
However, since this is a local file read (crown icon SVG), the security concerns are minimal. For local file access, you should use $wp_filesystem->get_contents()
, and that method simply calls the native PHP's file_get_contents()
, so you may use it directly in your code - for reading local files/resources.
Based on web search results
Apply this diff to use WordPress filesystem API:
- 'title' => __( 'SEO Settings', 'wp-user-frontend' ) . '<span class="pro-icon-title"> ' . file_get_contents( $crown_icon_path ) . '</span>',
+ 'title' => __( 'SEO Settings', 'wp-user-frontend' ) . '<span class="pro-icon-title"> ' . $this->get_crown_icon_content() . '</span>',
Then add this helper method to the class:
private function get_crown_icon_content() {
global $wp_filesystem;
if ( empty( $wp_filesystem ) ) {
require_once ABSPATH . 'wp-admin/includes/file.php';
WP_Filesystem();
}
$crown_icon_path = WPUF_ROOT . '/assets/images/crown.svg';
return $wp_filesystem->exists( $crown_icon_path ) ? $wp_filesystem->get_contents( $crown_icon_path ) : '';
}
🧰 Tools
🪛 GitHub Check: Run PHPCS inspection
[warning] 228-228:
file_get_contents() is discouraged. Use wp_remote_get() for remote URLs instead.
🤖 Prompt for AI Agents
In includes/Free/Free_Loader.php around line 228, replace the direct
file_get_contents($crown_icon_path) call with a helper that uses the WordPress
Filesystem API: add a private get_crown_icon_content() method that ensures
$wp_filesystem is initialized (require_once ABSPATH .
'wp-admin/includes/file.php' and call WP_Filesystem()), checks
$wp_filesystem->exists($crown_icon_path) and returns
$wp_filesystem->get_contents($crown_icon_path) or an empty string; then update
the 'title' line to call this helper instead of file_get_contents.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
optimize the image please. current image size is 1.12 MB
done @sapayth vai |
* feat: Add SEO Settings module for WP User Frontend Pro * chore: compressed image size: * chore: minify image file
Close issue , Related PRO PR
feat: Add SEO Settings module for WP User Frontend Pro
This commit introduces a brand-new SEO Settings module to WPUF Pro,
providing advanced control over how user profiles and directories are
indexed by search engines. The module is designed to give site owners
flexibility in managing visibility while preventing conflicts with other
SEO plugins or WordPress global SEO settings.
Key Features
SEO Settings Tab in WPUF Settings:
A dedicated section to configure SEO-related options directly within
the plugin, keeping all customization centralized.
User Directory SEO Section:
Includes the ability to set
noindex
for user profile pages,ensuring sensitive or duplicate content can be hidden from
search engines when required.
Conflict Detection:
Warns administrators if WordPress global SEO settings conflict with
WPUF’s SEO options, reducing the risk of misconfiguration.
Extended Compatibility:
Supports shortcodes, Gutenberg blocks, and pretty URLs so that SEO
configurations work consistently across different page builders and
frontend display modes.
Meta Tag Management:
Uses WordPress’s
wp_robots
filter for proper and reliable meta taginjection, ensuring that search engines respect indexing preferences.
Documentation & UI Assets:
Added a dedicated thumbnail for module recognition and linked
documentation to guide users in setting up SEO options effectively.
This module represents a major step in making WPUF more SEO-friendly
out of the box, empowering site owners to control search visibility
without needing third-party tools for common scenarios.
Summary by CodeRabbit