-
Notifications
You must be signed in to change notification settings - Fork 383
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
AMP posts don't work with %category% in permalink structure #314
Comments
Hello Nicholas. Maybe you can test my version https://github.com/gabrielperezs/amp-wp , in theory must work in your case. |
Hey, Your plugin actually works perfectly, whatever you did, you should tell the Automatic guys about it. An instant fix for me, only problem is that it thinks it's the original plugin, so it wants to be updated. |
Hi, I added your plugin in my website. But how I can validate it that it works or not. Earlier I was using the plugin https://wordpress.org/plugins/accelerated-mobile-pages/ but getting lots of error from my webmaster. So added your plugin but not sure it's working or not. Thanks |
I checked that it works with Posts but not pages. |
Hello @nicholasgriffintn Thanks! I sent the pull request to the original plugin, I hope they include my code in some way :) |
Hey @dineshitchimes you still has my plugin version on your site? because I can't see the rel amphtml , and any /amp/ url works. Tell me if I can check it. |
Hi, Here you can see : https://www.moability.com/blog/the-trend-shifts-in-app-development-spectrum-2015/amp Thanks & Regards |
@dineshitchimes but your are using the amp-wp offical plugin. And this don't has support for pages, archive, tags,... I did a fork ( https://github.com/gabrielperezs/amp-wp ) to develop this part, if you want to try. Disable the official before install my fork. |
Added your develop plugin Thanks for your help. |
This might be an issue with |
Also I am getting errors from google for AMP. How to fix it ? Can you help me out here ? Thanks |
Did you get a chance to look in ? Thanks |
@gabrielperezs why not you submit your code to official repo? Just submit a pull request, because your updates are very essential, and logical improvement for amp-wp. Otherwise when Automattic will push their updates with more feature anybody using your version will be in weird situation. |
@gabrielperezs Thank you so much, but it seems to have conflict and never got accepted. Do you think the way you enabled AMP for all pages is possible to do via functions.php or making an addon type small plugin? Otherwise can't really deploy in real site, as when Automattic push update, will be in weird situation. |
@Asif2BD when I send the pull request was without conflict. I think the authors don't want to go in this way. I don't know :) I'm working on this option, but the AMP original plugin has no hooks to do this changes from functions.php, at the moment.. |
Let me know if you could do that. I was working to change the amp url pattern, and cooking something interesting. If you could have find a way, I could make good use of it. Thanks in advance. |
I simply did not find your bug report before, and I posted a similar support request here: https://wordpress.org/support/topic/amp-permalink-not-working?replies=6 What should I do to solve this problem? Just install @gabrielperezs version for the time being, and then hope that his fix will be implemented in the official plugin? |
Btw, @gabrielperezs can't you just submit a pull request with only the part of your code that enables more custom permalinks to work? Maybe the authors do not want to (or simply cannot) implement all the features in your fork |
If I am not wrong @gabrielperezs's fix what mainly does it enable amp for all type of page, not limited to singular type. So, it will not solve permalink issue you have. It does not to anything new for single post. |
In fact, I installed it and it does not work. I thought that the original issue in this thread was the same I had :( |
Anyway, I am completely at loss here to understand why they just started working again, a couple minutes after deleting this fork and re-activating the original AMP plugin. |
It should not, if you look at his code, all it does it extends plugin capacity from singular to other page type. You could look at this issue I create #353 But currently 'amp_get_permalink' is limited and wont let you edit it with regular hooks, developer proposed something like 'amp_pre_get_permalink', but still not available. I am personally trying to create something to solve my issue, and looking forward to release as free plugin. |
It used to work, it does not any longer after some changes to the amp coding I think, the issue does still exist in the original plugin also. It would be nice if this issue could be fixed in the original one, as we are unable to use AMP currently, and that's rather annoying. |
Hi @gabrielperezs, http://www.foodfest.sk/jedla/obed/amp/ Can you help me please how to fix it and enable amp? |
Hi @gabrielperezs , I would like to ask you there is any possibility to help me. Look here: These pages are redirected to URL with no /amp/ at the end. function isa_amp_add_cpt() { add_post_type_support( recipe', AMP_QUERY_VAR ); It looks like It should be working but It does not (post_type=recipe, taxonomy=ingredient) /wp-admin/term.php?taxonomy=ingredient&tag_ID=278&post_type=recipe&wp_http_referer=%2Fwp-admin%2Fedit-tags.php%3Ftaxonomy%3Dingredient%26post_type%3Drecipe Is there any way to help me enable AMP. Thanks for any help. Martin |
Oh what a bummer. Still an issue today? I just stumbled on this and noticed the permalinks break when using %category% in the custom permalinks field. Has anyone figure a work around yet? Because there is no way we will ever change our permalink structure and destroy healthy SEO. |
I've same problem, amp doesnt work for single article if /%category%/%postname%/ is set in permalink structure. Im waiting for response. |
This issue shows itself when selecting and one of the custom permalink structures on the Until this get's fixed, you can use the following code to get your endpoints to work (this is for the <?php
add_action( 'init', 'mg_reorder_rewrite' );
/**
* Re-order AMP rewrite rule.
*
* This fixes a bug in the Automattic AMP plugin when using custom permalink
* structures, WordPress sees AMP endpoints as attachments.
*/
public function reorder_rewrite() {
add_rewrite_rule('([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/amp(/(.*))?/?$', 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&=$matches[6]', 'top');
} Basically the above code is just adding the rewrite rule earlier than the attachment rule. Remember to flush rewrite rules (just visit the permalink page in the admin) for this to work. |
I'm going to close this in favor of #2204, where we should move to using |
Hey,
I posted a support request on the Wordpress.org page, haven't received a response so I figured I'd re-post it here.
It seems as though the plugin does not like permalinks other than the date format one, which is bad news for a lot of publishers like myself, who like to use category and name permalinks. You can read my full post here:
https://wordpress.org/support/topic/permalink-problems-28?replies=4
Figured it's better to post the link than just copy and paste.
The text was updated successfully, but these errors were encountered: