post title
Support › MB Frontend Submission › post titleResolved
- This topic has 8 replies, 2 voices, and was last updated 2 years, 1 month ago by
[email protected].
-
AuthorPosts
-
February 22, 2023 at 11:47 PM #40682
[email protected]
ParticipantI 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
February 23, 2023 at 5:36 PM #40695Peter
ModeratorHello,
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 bepost_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?February 28, 2023 at 10:08 PM #40762[email protected]
ParticipantThis is a live site - so can't really do that
but there is another form which works fine - is there a clash there?
March 1, 2023 at 5:41 PM #40768Peter
ModeratorHello,
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?March 1, 2023 at 10:19 PM #40781[email protected]
ParticipantI 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; } ); ?>
March 2, 2023 at 7:07 PM #40792Peter
ModeratorHello,
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 conditionif
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; } );
March 2, 2023 at 9:47 PM #40793[email protected]
Participantis 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;
March 3, 2023 at 7:11 AM #40798Peter
ModeratorHello,
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 } );
March 3, 2023 at 6:33 PM #40806[email protected]
Participantthank you for your patience that seems to have worked
-
AuthorPosts
- You must be logged in to reply to this topic.