Support Forum
Support › MB Frontend Submission › post titleResolved
I have 2 forms one for a site and another for a sub site - the form on the sub-site doesn't seem to work with the post title - I have included the shortcode for the form. the post type is set to not support the title on both post types is this correct - seems to work on the main form
[mb_frontend_form id='green-care-sub-site-form' post_fields='title' post_type='green-care-sub-site' redirect='https://sfgqualitymark.org.uk/user-dashboard-sub-site/' submit_button='Save Your Form']
https://sfgqualitymark.org.uk/green-care-sub-site-form/
kind regards
Paul
Hello,
I see this is the title field in the frontend form https://monosnap.com/file/fZ5SuBuxE66vJExPIwsq0L8MAVvMyd
But somehow it does not have the correct ID, should be post_title
. Can you please try to deactivate all plugins except Meta Box, MB extensions and switch to a standard theme of WordPress then check this issue again?
This is a live site - so can't really do that
but there is another form which works fine - is there a clash there?
Hello,
Yes, I see the post title work on the page https://sfgqualitymark.org.uk/green-care-form/
But I'm not sure why this happens on another page without some troubleshooting steps. Can you please copy your site to a staging site and do the test there?
I have done this and I think it's down to one of these bits of code - or both - you gave me this code so not sure but when I turn both off it seems to work - can we combine them maybe
they alter the label of the title field for both forms
<?php
add_filter( 'rwmb_frontend_post_title', function( $field ) {
if ( is_page( "Green Care Form" ) ) {
$field['required'] = true;
$field['name'] = 'Name of Green Care organisation';
return $field;
}
} );
?>
<?php
add_filter( 'rwmb_frontend_post_title', function( $field ) {
if ( is_page( "Green Care Sub Site Form" ) ) {
$field['required'] = true;
$field['name'] = 'Name of Green Care Sub Site';
}
return $field;
} );
?>
Hello,
I see the code snippet in the topic https://support.metabox.io/topic/user-dashboard-displaying-the-right-form/?swcfpc=1
As the suggestion, please move the return
statement outside of the condition if
statement and check the title again.
add_filter( 'rwmb_frontend_post_title', function( $field ) {
if ( is_page( "Green Care Form" ) ) {
$field['required'] = true;
$field['name'] = 'Name of Green Care organisation';
}
return $field;
} );
is that on both of them?
and do you mean like below - sorry not a coder!
add_filter( 'rwmb_frontend_post_title', function( $field ) {
if ( is_page( "Green Care Form" ) ) {
$field['required'] = true;
$field['name'] = 'Name of Green Care organisation';
}
} );
return $field;
Hello,
Just the first block of code for the "Green Care Form" page as I mentioned above.
add_filter( 'rwmb_frontend_post_title', function( $field ) {
if ( is_page( "Green Care Form" ) ) {
$field['required'] = true;
$field['name'] = 'Name of Green Care organisation';
}
return $field; // here
} );
thank you for your patience that seems to have worked