-
Notifications
You must be signed in to change notification settings - Fork 802
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
Mobile: Hide edit post link in content #12867
Conversation
Thank you for the great PR description! When this PR is ready for review, please apply the Scheduled Jetpack release: July 2, 2019. |
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.
Do you think it would make sense to shorten this into something like:
if ( Jetpack_User_Agent_Info::is_mobile_app() ) {
add_filter( 'edit_post_link', '__return_empty_string' );
}
Should we also consider moving this out of the Minileven module, so it can be applied regardless of the theme you are using, and even if the mobile theme feature / module is not enabled on your site?
Ha. Yes, init-per-request mindset is still a stranger to me.
Can you suggest the ideal place for this code? I just followed where |
It may be best to place it in |
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.
This works well for me. 👍
* Add initial changelog / testing list changes for 7.6 * Update stable tag to 7.5.3 * changelog: add #12957 * Changelog: add #12932 * Changelog: add #12867 * Changelog: add #12823 * changelog: add #12969 * changelog: add #13012 * changelog: add #12974 * Changelog: add #13059 * Changelog: add #13079 * Changelog: add #12924 * changelog: add #12954 * Changelog: add #12959 * Changelog: add #12977 * Changelog: add #12830 * Changelog: add #12926 * Changelog: add #12958 * Changelog: add #12999 * Changelog: add #13077 * Changelog: add #13083 * Changelog: add #13087 * Changelog: add #13110 * Changelog: add #13116 * Changelog: add #13117 * Changelog: add #12821 * Changelog: add #13120 * changelog: add #13139 * Changelog: add #13143 * Changelog: add #13147 * Testing list: add section about sync
* Add initial changelog / testing list changes for 7.6 * Update stable tag to 7.5.3 * changelog: add #12957 * Changelog: add #12932 * Changelog: add #12867 * Changelog: add #12823 * changelog: add #12969 * changelog: add #13012 * changelog: add #12974 * Changelog: add #13059 * Changelog: add #13079 * Changelog: add #12924 * changelog: add #12954 * Changelog: add #12959 * Changelog: add #12977 * Changelog: add #12830 * Changelog: add #12926 * Changelog: add #12958 * Changelog: add #12999 * Changelog: add #13077 * Changelog: add #13083 * Changelog: add #13087 * Changelog: add #13110 * Changelog: add #13116 * Changelog: add #13117 * Changelog: add #12821 * Changelog: add #13120 * changelog: add #13139 * Changelog: add #13143 * Changelog: add #13147 * Testing list: add section about sync
Fixes wordpress-mobile/WordPress-iOS#13314 This issue was introduced in #12867. The original goal of this change was to to hide the Edit Post link whenever you would access your site via the mobile app's in-app browser. To hide the Edit Post link, we originally opted to hook into the edit_post_link filter. While this works, it only changes the string returned for the Edit Post link itself. It does not account for any "before" or "after" parameters that may be passed when calling the edit_post_link function; those are not part of the filter: https://github.com/WordPress/WordPress/blob/001ffe81fbec4438a9f594f330e18103d21fbcd7/wp-includes/link-template.php#L1439 Instead, let's shortcircuit that link earlier, by hooking into the get_edit_post_link filter. If that filter is set to return an empty string, the edit_post_link function will return early: https://github.com/WordPress/WordPress/blob/001ffe81fbec4438a9f594f330e18103d21fbcd7/wp-includes/link-template.php#L1420
Fixes wordpress-mobile/WordPress-iOS#13314 This issue was introduced in #12867. The original goal of this change was to to hide the Edit Post link whenever you would access your site via the mobile app's in-app browser. To hide the Edit Post link, we originally opted to hook into the edit_post_link filter. While this works, it only changes the string returned for the Edit Post link itself. It does not account for any "before" or "after" parameters that may be passed when calling the edit_post_link function; those are not part of the filter: https://github.com/WordPress/WordPress/blob/001ffe81fbec4438a9f594f330e18103d21fbcd7/wp-includes/link-template.php#L1439 Instead, let's shortcircuit that link earlier, by hooking into the get_edit_post_link filter. If that filter is set to return an empty string, the edit_post_link function will return early: https://github.com/WordPress/WordPress/blob/001ffe81fbec4438a9f594f330e18103d21fbcd7/wp-includes/link-template.php#L1420
Changes proposed in this Pull Request:
Adds an
edit_post_link
filter to return empty string if request is from an WordPress mobile app.Hides edit post link in post content if client is a WordPress mobile app.
Is this a new feature or does it add/remove features to an existing part of Jetpack?
No. This is a manual sync PR for D29686-code.
See trac link in the patch for more detail on the issue this PR and the mentioned patch addresses.
Testing instructions:
Proposed changelog entry for your changes:
Hide edit post link in post content if client is a WordPress mobile app.