-
Notifications
You must be signed in to change notification settings - Fork 4
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
Feature: Checkbox to allow / disallow robots to index #124
base: master
Are you sure you want to change the base?
Conversation
Added conditionals to hide_post_from_searchengines, change_robots_for_rankmath, and no_robots_for_unlisted_posts properties to check if robots should be enabled
This field is to be used for when setting no index to check if it should be indexed or not.
* | ||
* @return Void | ||
*/ | ||
public function save_meta_enable_robots( $post_id ) { |
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.
Similar blocks of code found in 2 locations. Consider refactoring.
* | ||
* @return Void | ||
*/ | ||
public function save_meta_enable_robots( $post_id ) { |
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.
Function save_meta_enable_robots
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Code Climate has analyzed commit d84857c and detected 6 issues on this pull request. Here's the issue category breakdown:
View more on Code Climate. |
Refactored to be CodeClimate compliant
* @param array $enable_robots Array of post ids that should allow robots | ||
* @return boolean False - This is the default value. This means that robots are disabled. | ||
*/ | ||
private function robots_enabled_check( $hidden_posts, $enable_robots ) { |
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.
Function robots_enabled_check
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Refactored to be CodeClimate compliant
* @param Post $post The current post object. | ||
* @return void | ||
*/ | ||
function render_unlist_posts( $post ) { |
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.
Similar blocks of code found in 2 locations. Consider refactoring.
* @param Post $post The current post object. | ||
* @return void | ||
*/ | ||
function render_enable_robots( $post ) { |
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.
Similar blocks of code found in 2 locations. Consider refactoring.
Description
Added the ability to set noindex or index via a checkbox below the existing meta box field
Screenshots
Types of changes
New feature
How has this been tested?
Checked the box, viewed source code for unlisted page, saw it allowed indexing. Unchecked the box, viewed source code, saw it had noindex again. Repeated process for published pages.
Checklist: