Hello and thank you for your amazing plugin: I love it
That’s my problem.
I have created a custom post (called Templates).
I have created a custom field via ACF Pro to set an url to the demo.
If I put a site address in this field and click to Publish: no problems.
If I put an IP address (like http://192.168.6.24/gloryshop/ for example) in this field and click to Publish the post not will be published and I will be redirected to home page of the site.
Same thinks for other types of post.
Can you help me?
I’ve tested this on a clean WordPress install without any issues.
Can it be that another plugin is causing this? Try and disable all plugins except ACF and see if that resolves the issue.
Otherwise, see if you can setup a clean WordPress install with only ACF and your custom fields as well as your custom post type.
Ok… done some test…
Seems that the problem is the field name demo
: can you try?
It works on local and fresh installation but not in the production site with custom theme and some plugins.
I deactivated all the plugin except ACF Pro and reactivated the default theme: It still not work.
So it looks like the theme is the issue.
Clone the production website to a local server, try it out, if it still fails, use a different theme and see if the issue persists.
Is the fresh installation running on the same server as the production one? It might also be the production server that prevents WordPress from storing IP’s, although this is unlikely.
This problem has been reported on and off for URLs in ACF fields and it can happen with text fields as well as URL fields, but has never been resolved because in testing no one has ever been able to reliably recreate the issue.
The best that can be said is that it may have something to do with server/php settings on your live server. To debug this you need to figure out where and why the redirect to a bad page is happening and the only way to do this would be follow the save process of the options page through all of the acf code and figure out where the URL of the ACF field is effecting the URL that WP is trying to redirect to.
What we need is for someone that has to ability to do the debugging to also be able to reliably recreate the issue.
So… I can be your man!
Do you have some step-by-step indications to “record” the problem and give to you something of “report”?
Not really. I don’t know all of the sequence of events that happens. If I was going to do this I would start at the beginning where the post is submitted to, this would be the file /wp-admin/admin.php. I’d then end up doing a lot of searching and figuring out what happens next. I would edit code and put in
echo '<pre>'; print_r($some_array); die;
or
echo $some_value; die;
so that I can see what’s happening along the way. I would keep progressing further through the code. and I would hope that eventually I saw something, or came across some reason as to why the redirect was causing a 404. More than likely at some point I’d start making alterations to values to see if I could stop it from happening.
Debugging is mostly guesswork once you get past the “where to start” question.
You could also reverse that and start at the end, sometimes starting at the end can get you further than starting at the beginning. I think, but I’m not 100% sure, that the redirect happens on line 236 of /advanced-custom-fields-pro/pro/admin/options-page.php
No problem, I wish you luck. You’re probably looking at several hours of work just to narrow the problem down.
The topic ‘Bad redirect after publish post with IP address in URL field’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.