REST API: Settings: fix jetpack_relatedposts_enabled#7480
Merged
sirbrillig merged 1 commit intomasterfrom Jul 18, 2017
Merged
Conversation
See 69-gh-wp-calypso The REST API settings endpoint includes a property `jetpack_relatedposts_enabled`, which is true if the Related Posts plugin will display related posts. The value from this endpoint is incorrect, however, when a site has not modified their settings. This is because the `Jetpack_RelatedPosts` plugin defaults the setting to be enabled if it is not set. This change modifies the endpoint to use the same logic: if the setting is not set, it will default to reporting `jetpack_relatedposts_enabled` as true. Some sites (VIP and Jetpack) default this setting to `false` instead, but the way this is accomplished is that when the plugin is loaded by `wp-content/mu-plugins/related-posts.php`, it actively changes the option to `false`. Since that loader should still be used by the REST API, that should mean that such sites will continue to have `jetpack_relatedposts_enabled` reported correctly. This commit syncs r159322-wpcom.
lezama
approved these changes
Jul 18, 2017
Contributor
|
LGTM 👍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See 69-gh-wp-calypso
The REST API settings endpoint includes a property
jetpack_relatedposts_enabled, which is true if the Related Posts plugin will display related posts. The value from this endpoint is incorrect, however, when a site has not modified their settings. This is because theJetpack_RelatedPostsplugin defaults the setting to be enabled if it is not set.This change modifies the endpoint to use the same logic: if the setting is not set, it will default to reporting
jetpack_relatedposts_enabledas true.Some sites (VIP and Jetpack) default this setting to
falseinstead, but the way this is accomplished is that when the plugin is loaded bywp-content/mu-plugins/related-posts.php, it actively changes the option tofalse. Since that loader should still be used by the REST API, that should mean that such sites will continue to havejetpack_relatedposts_enabledreported correctly.This commit syncs r159322-wpcom.
Testing instructions:
Related postssetting reads "Show related content after posts".settings>jetpack_relatedposts_enabledisfalse.settings>jetpack_relatedposts_enabledistrue.settings>jetpack_relatedposts_enabledisfalse.