You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using a repeater with a group a fields, the "add new" button is broken.
The ajax URL called when hitting the button is returning a 404. I found out the URL is only working when permalinks are enabled.
This should work in any case.
Checking the source code, I also noticed you didn't take advantage of the WordPress ajax "api", this would probably save some bugs (this one included) and provide a "native" way to achieve all the papi ajax stuffs.
There's also a tiny problem with adding your own endpoints with add_rewrite_rule, you need to flush rewrite rules so they can be added to all rewrite rules.
The steps provided to reproduce this bug isn't working. Setting permalinks to simple doesn't work, I have also tried to reinstall my WordPress installation and reproduce the same steps as you provided without success.
On a fresh installation I have selected "plain" permalinks
Have a repeater property with a child properties
papi-ajax endpoint works for me, maybe some type of cache in WordPress that isn't flushed or something like that.
Running wp cli don't help.
→ wp rewrite flush
Warning: Rewrite rules are empty, possibly because of a missing permalink_structure option. Use 'wp rewrite list' to verify, or 'wp rewrite structure' to update permalink_structure.
→ wp rewrite list
Warning: No rewrite rules.
So I'm unable to reproduce this right now but I have created a example that don't use papi-ajax endpoint when permalink structure is empty, would be great if you can try it 126f842
With this solution we could remove papi-ajax endpoint and add a query string papi-ajax=true instead so plain permalink structure and the others use the same solution. papi-ajax endpoint it's nice but not necessary to use a real endpoint for that.
I think I know what's the issue here. Are you using Apache? Do the .htaccess file contains the WP rewrite rules? If so, you will not see the issue described here.
Same goes is you're using nginx (rewrite rules are enabled by default).
In order to reproduce the issue, you must either not have an .htaccess file or it must not contain rewrite rules.
I'll try your fix but I looks like the one I used to fix this. I'll give you some feedback within the day.
Activity
frozzare commentedon Feb 13, 2017
You get a lot of overhead with WP's built in ajax api so that's why I'm not using it and that will not change.
Simple permalinks should work but haven't been tested since I never use simple permalinks. Will look at a solution so simple permalinks should work.
frozzare commentedon Feb 13, 2017
The steps provided to reproduce this bug isn't working. Setting permalinks to simple doesn't work, I have also tried to reinstall my WordPress installation and reproduce the same steps as you provided without success.
nlemoine commentedon Feb 13, 2017
Sorry, the english name for the permalinks setting is "Plain", not "Simple".
I can easily reproduce it on a fresh install with this sample type:
frozzare commentedon Feb 13, 2017
papi-ajaxendpoint works for me, maybe some type of cache in WordPress that isn't flushed or something like that.Running wp cli don't help.
→ wp rewrite flush
Warning: Rewrite rules are empty, possibly because of a missing permalink_structure option. Use 'wp rewrite list' to verify, or 'wp rewrite structure' to update permalink_structure.
→ wp rewrite list
Warning: No rewrite rules.
So I'm unable to reproduce this right now but I have created a example that don't use
papi-ajaxendpoint when permalink structure is empty, would be great if you can try it 126f842With this solution we could remove
papi-ajaxendpoint and add a query stringpapi-ajax=trueinstead so plain permalink structure and the others use the same solution.papi-ajaxendpoint it's nice but not necessary to use a real endpoint for that.nlemoine commentedon Feb 13, 2017
I think I know what's the issue here. Are you using Apache? Do the
.htaccessfile contains the WP rewrite rules? If so, you will not see the issue described here.Same goes is you're using nginx (rewrite rules are enabled by default).
In order to reproduce the issue, you must either not have an
.htaccessfile or it must not contain rewrite rules.I'll try your fix but I looks like the one I used to fix this. I'll give you some feedback within the day.
nlemoine commentedon Feb 13, 2017
👍