Maciej Bis
Forum Replies Created
-
I see – the best idea here would be instead to simply remove the /filter/ endpoint from the list of endpoints supported by Permalink Manager:
function pm_exclude_filter_endpoint( $endpoints ) {
return preg_replace('/(\||^)(filter)(\||$)/', '$3', $endpoints );
}
add_filter( 'permalink_manager_endpoints', 'pm_exclude_filter_endpoint', 100 );Ok, it means that the snippet needs one more adjustment – please use this version instead:
function pm_ignore_filter_endpoint( $uri_parts, $request_url, $endpoints ) {
if ( ! empty( $uri_parts['endpoint'] ) && $uri_parts['endpoint'] == 'filter' ) {
$uri_parts['uri'] .= "/filter";
$uri_parts['endpoint'] = "";
}
return $uri_parts;
}
add_filter( 'permalink_manager_detect_uri', 'pm_ignore_filter_endpoint', 100, 3 );Excellent, I am glad it works now and sorry that it took so long!
Thanks, please make sure that the code snippet is activated:
Hmm, I tested it with both WPCode & functions.php and it worked correctly.
Could you send me once again the screen with the snippet contents + the snippet settings (if you use WPCode to add it)?
Yes, I think I got it now – please replace the first snippet with the new one:
function pm_ignore_filter_endpoint( $uri_parts, $request_url, $endpoints ) {
if ( ! empty( $uri_parts['endpoint'] ) && $uri_parts['endpoint'] == 'filter' && empty( $uri_parts['endpoint_value'] ) ) {
$uri_parts['uri'] .= "/filter";
$uri_parts['endpoint'] = "";
}
return $uri_parts;
}
add_filter( 'permalink_manager_detect_uri', 'pm_ignore_filter_endpoint', 100, 3 );Yes, that is normal given that the widow “filter” endpoint should not display any content if used as a last segment of URL. Therefore, WordPress natively displays “hard 404 error” to prevent duplicate content SEO issue.
Based on the initial comment, I assumed you wanted to have that exact URL behave the same as if the plugin was turned off. And this is how it actually works in the end and IMHO technically it is no longer a problem, as long as that URL does not have any backlinks and is not indexed by Google or other search engines.
To be more specific, the code snippet that I sent you makes Permalink Manager ignore all the URLs that end with “/filter/” endpoint.
If “the problem has not been fixed, but only changed”, what other solution would you suggest in this situation?
- This reply was modified 6 days, 23 hours ago by Maciej Bis.
Hi, what do you mean with “leads to the same 404 page in both cases”?
I mean that that the specific URL displays exactly the same 404 error page both: when the plugin is activated or deactivated.
https://ronb33.sg-host.com/de/schweisrauchabsaugung/filter/The pages load correctly with the plugin activated with the exception of /de/filter.
I think we have some misunderstanding here, because I am still not sure what you mean. Please let me know how this works when the plugin is deactivated and how this should work when the plugin is activated.
And also, as I said, with the deactivation of the plugin almost all the pages give 404 error, so it is not a correlation with the problem with that specific case.
This is how it works, because my plugin not only generates & saves the custom permalinks, but also includes a function that detects them. In other words, if the plugin is disabled, the “detect function” is not active, so some of the pages (if their custom permalinks were different than native permalinks) will give 404 error.
The built-in WordPress permalink functionality is limited to simple URL formats based on rewrite rules, making it necessary to use extra plugins for more complex URL setups.
Hi @ericafontimedia,
Ok, I got it, please correct me if I am wrong. If the /filter/ URL now leads to the same 404 page in both cases, it indicates the initial problem (reported in the first post) has been fixed.
I can only assist addressing any issues that occur when the plugin is active and do not appear when the plugin is deactivated.
Best regards,
MaciejForum: Plugins
In reply to: [Permalink Manager Lite] page with .html not workingHi @rustykins,
Thank you! I think that the source of confusion here is a bug introduced in one of the latest updates. The canonical permalink displayed next to “Permalink Manager” button should not display the default permalink, but instead the actual permalink which is displayed under “Custom permalink” field. This happens because the plugin has not generated and saved the custom permalink for the product, defaulting to a “future” permalink (for preview).
Happily, to fix this all you need to do is simply update that post. The “Default custom permalink” field indicates the correct URL ending with .html and “auto-update” mode is turned on, so the correct permalink should be set then.
Forum: Plugins
In reply to: [Permalink Manager Lite] page with .html not workingHi @rustykins,
Thank you – as far as I can see, the custom permalink for that specific product does not seem to be stored by my plugin. Do you possibly have another permalink plugins enabled on your website. Please send me the screenshot with the “edit page” where the URL ending with .html is displayed?
Forum: Plugins
In reply to: [Permalink Manager Lite] page with .html not workingHi @rustykins,
Could you possibly send me a sample product URL?
As I can see, the page returns 404 error and it works exactly the same way as when the plugin functions are conditionally deactivated:
Permalink Manager disabled:
https://ronb33.sg-host.com/de/schweisrauchabsaugung/filter/?disable-pm=1Permalink Manager enabled:
https://ronb33.sg-host.com/de/schweisrauchabsaugung/filter/To confirm this and compare, please deactivate the plugin from “Plugins” dashboard and send me the screenshot with the content displayed on that specific page.
- This reply was modified 1 week, 2 days ago by Maciej Bis.
Thank you, now I see where the problem is. The snippet does not work because the snippet is added as a HTML code.
Could you change the snippet type to “PHP Snippet” here:
or alternatively paste the code to the end of /wp-content/themes/hello-elementor-child/functions.php file?
https://permalinkmanager.pro/blog/how-to-add-php-snippet-to-wordpress-3-methods/#3-how-to-insert-php-code-in-wordpress-without-pluginTo provide more context, please make the screenshot from your admin dashboard with the section where the code snippet is inserted. You can upload it to e.g. https://imgur.com/