Closed jose-tog closed 5 months ago
@cyberscribe Please help. I was able to replicate the issue with the example in the examples folder. Configure route /speaker/jose/ so that it would redirect to /speaker/9-jose/ and same issue.
The filter post_type_link is not firing, therefore it cannot re-route
// Load global functionality function wp_mvc_load_global_functionality(&$loader) { //public or admin, depending on context add_action('init', array($loader, 'init')); add_action('widgets_init', array($loader, 'register_widgets')); add_filter('post_type_link', array($loader, 'filter_post_link'), 10, 2); add_action('plugins_loaded', 'wpmvc_load_plugin_textdomain' ); }
@jose-tog thanks for your message. If I understand correctly you are creating custom post types to mirror the mvc types and it is in the custom post types that redirects stopped working.
As you know, this plugin was abandoned by the author many years ago, and I stepped in to help with basic bug or security fixes only because many of my clients still use it. However, none of them use the custom post types mirroring, so I am not really familiar with that code.
I don't think the post_type_link filter was removed in the latest version of WordPress Core, so I'm not sure why you are experiencing this issue now. If you do find a resolution for it, I would be happy to accept a pull request so that others can benefit.
@cyberscribe I believe I found the "bug". In the code where it registers a custom post (mvc_post_adaptar.php line 133), two of the $args, publicly_querable is set to false and exclude_from_search is set to true. In order for things to work again, in my model I added publicly_querable = true and exclude_from_search = false for the args definition. But you do have to go the the object and save it again, that was one drawback. So technically it might not be a bug but a config setting which can be overwritten from you model.
Thanks for the update. If you want to formalise it into a pull request I will review.
On Tue, 30 Apr 2024 at 17:22, Jose Martinez @.***> wrote:
@cyberscribe https://github.com/cyberscribe I believe I found the "bug". In the code where it registers a custom post (mvc_post_adaptar.php line 133), two of the $args, publicly_querable is set to false and exclude_from_search is set to true. In order for things to work again, in my model I added publicly_querable = true and exclude_from_search = false for the args definition. But you do have to go the the object and save it again, that was one drawback. So technically it might not be a bug but a config setting which can be overwritten from you model.
— Reply to this email directly, view it on GitHub https://github.com/tombenner/wp-mvc/issues/265#issuecomment-2085857551, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFJLZNX2KE3RIKM3RN5ATDY77AM3AVCNFSM6AAAAABG4URBM6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOBVHA2TONJVGE . You are receiving this because you were mentioned.Message ID: @.***>
Hi there, I've update my wordpress installation from 6.4 to 6.5. We used to have links such as /product/anarchy that would redirect to /product/29-anarchy. Meaning we have configured our models to create the custom post type. After updating to 6.5 the links are not getting redirected, when going to /product/anarchy I get a 404 Page Not Found. Not sure how to fix this issue or why is not redirecting anymore. I also tried saving permalinks, deactivating and activating my plugin and nothing. Thank you in advanced.