Custom Fields
Re-Envisioned
Support MB Frontend Submission Showing Taxonomies on the frontend form

This topic contains 12 replies, has 2 voices, and was last updated by  SWS 4 months, 2 weeks ago.

  • Creator
    Topic
  • #14889

    SWS
    Participant

    Hi,
    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.

Viewing 10 replies - 1 through 10 (of 12 total)
  • Author
    Replies
  • #14900

    Anh Tran
    Keymaster

    Hi @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?

    #14918

    SWS
    Participant

    Hi,

    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.

    back end edit taxonomy

    Back end edit post showing taxonomy field

    frontend submission form showing no taxonomy

    shortcode for frontend form

    Hope you can help.

    #14933

    Anh Tran
    Keymaster

    Ah, I got it.

    To show the taxonomy on the front end, you need to create a field with the field type taxonomy or taxonomy_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.

    #14936

    SWS
    Participant

    Hi,

    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?

    #14940

    Anh Tran
    Keymaster

    Hi @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.

    #14961

    SWS
    Participant

    Hi,

    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.

    #14972

    SWS
    Participant

    Hi,

    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’ );

    #15015

    Anh Tran
    Keymaster

    Hi SWS, modifying the plugin directly won’t help.

    Please try these steps:

    And then modify the code for the taxonomy or taxonomy_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,
    )
    #15051

    SWS
    Participant

    Hi,

    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

    #15052

    SWS
    Participant

    Hi,

    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.

Viewing 10 replies - 1 through 10 (of 12 total)

You must be logged in to reply to this topic.