-
Notifications
You must be signed in to change notification settings - Fork 384
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
wp_nav_menu suffix in Custom links to remote websites #7329
Comments
The plugin should only be adding the AMP endpoint to links on the same domain as the WP install. Are you saying it is adding the link to other parts of your site which are not part of the WordPress subdirectory install? What does The logic for determining whether a given link should get the AMP endpoint is as follows: amp-wp/includes/sanitizers/class-amp-link-sanitizer.php Lines 280 to 319 in 092b4b8
It seems it is not taking into account the Nevertheless, there is a filter you should be able to use to prevent this from happening in the immediate term. Something like this should do it: add_filter(
'amp_to_amp_linking_element_excluded',
static function( $excluded, $url ) {
if ( ! str_contains( $url, '/blog' ) ) {
$excluded = true;
}
return $excluded;
},
10,
2
); |
Thanks. Thank you for your add_filter solution (I did not tested it yet) |
@thelovekesh Would you update the logic in
$parsed_home = wp_parse_url( home_url() );
$this->home_host = $parsed_home['host'];
$this->home_path = $parsed_home['path']; |
@stouch The fix has been merged, and there is a pre-release production build you can test: #7330 (comment) |
QA Passed ✅ Cross-checked the issue, Fix is working as expected. Now, the suffix(/amp) for the custom link is not visible. Update
|
Bug Description
This plugin adds a suffix /amp to my custom links to remote websites in my footer menu (wp_nav_menu).
My blog is under a subpath (/blog) so I was able to manually remove this suffix (and keep it only for my blog links) with :
in
amp/src/PairedUrl.php
.Expected Behaviour
The suffix must no be added to custom links in wp menus.
Screenshots
No response
PHP Version
7.3
Plugin Version
latest
AMP plugin template mode
Transitional
WordPress Version
No response
Site Health
No response
Gutenberg Version
No response
OS(s) Affected
No response
Browser(s) Affected
No response
Device(s) Affected
No response
Acceptance Criteria
No response
Implementation Brief
No response
QA Testing Instructions
No response
Demo
No response
Changelog Entry
No response
The text was updated successfully, but these errors were encountered: