Showing Taxonomies on the frontend form
Support › MB Frontend Submission › Showing Taxonomies on the frontend form
- This topic has 13 replies, 3 voices, and was last updated 3 years, 1 month ago by
Sri.
-
AuthorPosts
-
June 8, 2019 at 10:35 PM #14889
SWS
ParticipantHi,
I've tried to look around but can't find how to do this. I might be missing something.I've got the full package of plugins.
Installed the base metabox one and created a content type and taxonomy.
When I add a new record from the backend I can see the taxonomy but not on my frontend form.I assume this might be down to including the correct ID for the taxonomy but I can't see it.
I've not copied the code for the content type and taxonomy into my plugin, only other metaboxes (which do show on the form).Am I missing something?
Thanks.
June 10, 2019 at 10:41 AM #14900Anh Tran
KeymasterHi @SWS,
Did you mean that you're using a field type
taxonomy
and it shows terms on the back end but not front end?Can you send some screenshots?
June 11, 2019 at 3:36 AM #14918SWS
ParticipantHi,
I created the taxonomies using the plugin UI and can see the field on the edit screen in the backend but it doesn't show on the frontend submission form.
As you can see the taxonomy is assigned to the post type and it shows on the right column when I edit it from the admin area but doesn't show on the frontend submission form.
Here are some screenshots.
Hope you can help.
June 11, 2019 at 4:30 PM #14933Anh Tran
KeymasterAh, I got it.
To show the taxonomy on the front end, you need to create a field with the field type
taxonomy
ortaxonomy_advanced
.The meta box for the taxonomy field on the right is the default WordPress's meta box, which won't show on the front end.
June 12, 2019 at 1:20 AM #14936SWS
ParticipantHi,
So do these things work together or do I need to not use the backend taxonomy feature in metabox?
It does seem a bit confusing to create the taxonomy in 2 different places.Can you clarify what should be used?
June 12, 2019 at 9:28 AM #14940Anh Tran
KeymasterHi @SWS,
You're right about creating taxonomies in 2 places. I've just added a commit that adds
remove_default
param for taxonomy field, which helps removing the default WordPress taxonomy meta box (it's enabled by default). Please try it.June 14, 2019 at 3:06 AM #14961SWS
ParticipantHi,
I think I must be missing something or being really stupid.
Even updating that one file in my copy of the plugin hasn't done anything.I'm getting a bit confused especially when you have the plugins MB Custom Post Type and MB Custom Taxonomy for using the UI to create these items (and MB Custom Post Type actually does both which makes the second one redundant?) but then you have the "register" code which I've tried adding to my plugin and that doesn't work.
What am I missing here? I've tried following the documentation examples too and not getting anywhere.
June 15, 2019 at 2:33 AM #14972SWS
ParticipantHi,
I think I'm getting somewhere. I've added this code into the plugin and now get this error when trying to load a frontend form.
Fatal error: Uncaught Error: Call to undefined function remove_meta_box() in /wp-content/plugins/meta-box/inc/fields/taxonomy.php on line 307
This is the line:
remove_meta_box( $id, null, 'side' );
June 20, 2019 at 3:25 PM #15015Anh Tran
KeymasterHi SWS, modifying the plugin directly won't help.
Please try these steps:
- Download the latest version on Github. Here is the link to the
.zip
file: https://github.com/wpmetabox/meta-box/archive/master.zip - Unzip it and copy all files to your host, overwriting old files of the plugins
And then modify the code for the
taxonomy
ortaxonomy_advanced
field and add another attribute to the field settings:'remove_default' => true
So the code of the field will be similar to this:
array( 'id' => 'my_field', 'name' => 'My Taxonomy', 'type' => 'taxonomy_advanced', 'taxonomy' => 'category', 'remove_default' => true, )
June 22, 2019 at 3:54 PM #15051SWS
ParticipantHi,
I've downloaded the zip file and replaced the plugin code on my website.
I've added the new attribute to the taxonomy fields but now the frontend form doesn't work.It shows these errors (redacted version).
Fatal error: Uncaught Error: Call to undefined function remove_meta_box() in public_html/wp-content/plugins/meta-box/inc/fields/taxonomy.php:306 Stack trace: #0 public_html/wp-content/plugins/meta-box/inc/fields/taxonomy.php(292): RWMB_Taxonomy_Field::remove_default_meta_box(Array) #1 public_html/wp-content/plugins/meta-box/inc/field.php(552): RWMB_Taxonomy_Field::admin_enqueue_scripts(Array) #2 public_html/wp-content/plugins/meta-box/inc/meta-box.php(164): RWMB_Field::call(Array, 'admin_enqueue_s...') #3 public_html/wp-content/plugins/mb-frontend-submission/src/Form.php(89): RW_Meta_Box->enqueue() #4 public_html/wp-content/plugins/mb-frontend-submission/src/Shortcode.php(31): MBFS\Form->render() #5 public_html/wp-includes/shortcodes in public_html/wp-content/plugins/meta-box/inc/fields/taxonomy.php on line 306
June 22, 2019 at 4:01 PM #15052SWS
ParticipantHi,
Also, when I try and save the frontend form I get the following error now.
Fatal error: Uncaught Error: Class 'MBFS\RWMB_Field' not found in public_html/wp-content/plugins/mb-frontend-submission/src/Post.php:150 Stack trace: #0 public_html/wp-content/plugins/mb-frontend-submission/src/Post.php(78): MBFS\Post->save_thumbnail() #1 public_html/wp-content/plugins/mb-frontend-submission/src/Form.php(146): MBFS\Post->save() #2 public_html/wp-content/plugins/mb-frontend-submission/src/Shortcode.php(57): MBFS\Form->process() #3 public_html/wp-includes/class-wp-hook.php(286): MBFS\Shortcode->process('') #4 public_html/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(NULL, Array) #5 public_html/wp-includes/plugin.php(465): WP_Hook->do_action(Array) #6 public_html/wp in public_html/wp-content/plugins/mb-frontend-submission/src/Post.php on line 150
The site is experiencing technical difficulties.June 24, 2019 at 11:23 AM #15064Anh Tran
KeymasterHi SWS,
I think it's faster to let me help you directly. Can you send me a temporary admin account to fix that?
June 29, 2019 at 4:01 AM #15175SWS
ParticipantHi,
Sorry for the delayed reply. Just sent over the login details for you.
Hope you can help with it.
Thanks.
March 5, 2022 at 12:10 AM #34315Sri
ParticipantHi Anh Tran,
Thank you it was helpful.
How can I make this change as permeant without worrying about plugin update overwriting the file?
'remove_default' => true
Thank you
- Download the latest version on Github. Here is the link to the
-
AuthorPosts
- You must be logged in to reply to this topic.