Home › Forums › Backend Issues (wp-admin) › Tabs – On save post, bouncing back to first tab › Reply To: Tabs – On save post, bouncing back to first tab
Hey @virgodesign
I also hope that there will be a solution implemented into core.
You are right, the solution provided also sends an AJAX request when you open a post for editing, which is unnecessary, because the first tab is always selected by default.
I optimized the code a little, so that it only sends an AJAX request when it’s really necessary. It won’t send one on startup, only if a different tab is selected.
https://gist.github.com/gchtr/2d371918f3778683c61f629dbc545972
The solution currently saves the index as a transient, which is valid for 5 minutes. I like your idea of using the value just once and then deleting it right away. I added that to the gist as well.
Saving the current tab in a hidden field and store it in the database when saving a post might be the better solution, but it needs a little more effort to implement. I prefer the quick and easy fix here, because I don’t consider it to be a permanent solution.
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.