Hi, I setup a Custom post type Create form on the homepage of my website with redirect to the same page on submit.
When I submit the form, it doesn't save the new post and it redirects to mydomain.com/?_tt=1613479124, where it displays the default Archive page of my CPT.
I tried changing the form redirect criteria, but I always get the same problem.
The CPT hasn't Archive (has_archive NO).
If I move the form to another page, it works fine.
To see the form on the frontpage you have to click on the Big Black Button.
Cheers
Hi, I'm curious to know if the Content Toggle Panel could be causing some kind of interference here. Is it okay for me to try moving the Form outside of the Content Toggle Panel block temporarily to see if this solves the problem?
If that does not resolve the problem, I would like to temporarily deactivate some other plugins so I can test the form further.
Let me know if it's okay and I will continue testing.
Hey, yes, you can make tests, this is still a DEV website. But I can tell you I've already tested without the toggle panel.
cheers
Strange... for a temporary solution, I have turned on AJAX submissions for this form and the problem seems to be resolved. I'll continue to investigate and give you an update shortly.
I don't see anything obviously set up incorrectly here. If it's okay with you, I'd like to create a clone of the site using the All-in-One WP Migration plugin and run some additional tests locally where I have the ability to monitor code execution. Let me know if that is okay, and I will get started.
Hi Christian, I've another problem with the same form. The image upload button ("Hacer Foto") is correctly styled on Desktop, but on the mobile I see the default input button style. I attach some screenshots.
cheers
I've split your question about the mobile button styles into a separate ticket. I've also done some research and found a similar issue reported in the past: https://toolset.com/forums/topic/problem-with-astra-theme-taxonomies/
Our developers produced a workaround, which I have added as a custom code snippet in Toolset > Settings > Custom Code:
class tssnippet_Support_Submit_Forms_On_Archives {
private $data = null;
private $needs_restore = false;
function __construct() {
$this->maybe_save_postdata();
add_action( 'wp', array( $this, 'maybe_restore_postdata' ) );
}
public function maybe_save_postdata() {
if ( ! get_option( 'permalink_structure' ) ) {
// Note that this will not work on sites with ugly permalinks :-/
return;
}
if (
isset( $_POST['_cred_cred_prefix_form_id'] )
&& isset( $_POST['_cred_cred_prefix_form_count'] )
) {
$this->needs_restore = true;
$this->data = $_POST;
$_POST = array();
}
}
public function maybe_restore_postdata() {
if ( ! $this->needs_restore ) {
return;
}
$_POST = $this->data;
}
}
add_action( 'wp_loaded', 'tssnippet_load_support_submit_forms_on_archives' );
function tssnippet_load_support_submit_forms_on_archives() {
new tssnippet_Support_Submit_Forms_On_Archives();
}
Now, I can submit the Form without AJAX as expected and I can see the post is published correctly. Please take a look and let me know if the problem is not resolved.
Thnak you. Is it a Toolset bug or something that happens only on certain conditions?
My issue is resolved now. Thank you!
FYI the permanent solution for this problem will be included in the upcoming Forms 2.6.10 release. Once you update, the workaround is no longer required.
Forms 2.6.10 is now available.