Title: Front end post saving error
Last modified: August 24, 2016

---

# Front end post saving error

 *  Resolved [Teja](https://wordpress.org/support/users/teja8792/)
 * (@teja8792)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/front-end-post-saving-error/)
 * Hi,
    I tried cmb2-front-end-submit which is in CMB2 Snippet librabry for creating
   front end form for post creation through a plugin. And I include the CMB2 folder
   in the plugin for other metaboxes but for the front end saving, it returns **
   Fatal error: Call to undefined method CMB2::get_sanitized_values() in cmb2-front-
   end-submit.php on line 153**. on saving the form.
 * Thanks for the great plugin.
    I would appreciate your help. Thank you.
 * [https://wordpress.org/plugins/cmb2/](https://wordpress.org/plugins/cmb2/)

Viewing 8 replies - 1 through 8 (of 8 total)

 *  Plugin Contributor [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [11 years, 1 month ago](https://wordpress.org/support/topic/front-end-post-saving-error/#post-6012800)
 * could you provide the code you’re using for your implementation?
 *  Thread Starter [Teja](https://wordpress.org/support/users/teja8792/)
 * (@teja8792)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/front-end-post-saving-error/#post-6012911)
 * The file ([https://github.com/WebDevStudios/CMB2-Snippet-Library/blob/master/front-end/cmb2-front-end-submit.php](https://github.com/WebDevStudios/CMB2-Snippet-Library/blob/master/front-end/cmb2-front-end-submit.php))
   was included(using require_once function) in plugin functions. No changes done
   to the file. I included CMB2 in plugin-function.php.
    Do i have to include CMB2
   in cmb2-front-end-submit.php file too?
 * folder structure.
    -plugin-functions.php -inc/CMB2 -inc/cmb2-front-end-submit.
   php
 * Thank You.
 *  Plugin Contributor [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [11 years, 1 month ago](https://wordpress.org/support/topic/front-end-post-saving-error/#post-6012917)
 * As long as CMB2 is loaded already, I am not sure you need to. I’m not sure if
   you have the plugin version installed and activated, or if you’re treating it
   as a library you distribute.
 * From what I know, this is the part you need to include if you’re doing it as 
   a drop in library: [https://github.com/WebDevStudios/CMB2/blob/master/example-functions.php#L14](https://github.com/WebDevStudios/CMB2/blob/master/example-functions.php#L14)
 * The method giving you a fatal error is in `includes/CMB2.php` so somehow your
   code used above is being run before it’s defined and loaded.
 *  Thread Starter [Teja](https://wordpress.org/support/users/teja8792/)
 * (@teja8792)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/front-end-post-saving-error/#post-6012938)
 * I included the cmb2-front-end-submit.php like this.
 * if ( file_exists( dirname( __FILE__ ) . ‘/cmb2/init.php’ ) ) {
    require_once 
   dirname( __FILE__ ) . ‘/cmb2/init.php’; } elseif ( file_exists( dirname( __FILE__).‘/
   CMB2/init.php’ ) ) { require_once dirname( __FILE__ ) . ‘/CMB2/init.php’; } require_once(‘
   cmb2-front-end-submit.php’);
 * I ran into the error again. I am new to the coding, help me out.
 * Thank you.
 *  Thread Starter [Teja](https://wordpress.org/support/users/teja8792/)
 * (@teja8792)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/front-end-post-saving-error/#post-6012939)
 * The above code is placed in the plugin-functions.php, I am using the CMB2 folder
   as library(not downloaded from wordpress.org). And i am testing in the localhost.
 *  Plugin Contributor [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [11 years, 1 month ago](https://wordpress.org/support/topic/front-end-post-saving-error/#post-6012952)
 * I’m not familiar with any plugin-functions.php file, as it’s not something from
   CMB2 and it’s not a standard file name for themes, so I don’t know at all what
   order things are being loaded in or anything like that.
 * May be worth trying just installing CMB2 as a plugin instead of as a drop-in 
   library and see if that helps at all. You’d remove the need to manually include
   CMB2/init.php.
 * Alternatively, the path in the require_once lines above may not be matching up
   with your hierarchy, and thus CMB2 isn’t getting loaded properly.
 * I would be able to easily enough recreate folder structure if you let me know
   the hierarchy in your case.
 *  Thread Starter [Teja](https://wordpress.org/support/users/teja8792/)
 * (@teja8792)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/front-end-post-saving-error/#post-6012972)
 * Installed CMB2 as a plugin and it worked. Thanks. How can i use CMB2 as library?
 * i want to create the custom-plugin and its folder structure is:
 * custom-plugin(folder)
    /custom-plugin.php /inc(folder) /inc/CMB2(folder) /inc/
   cmb2-front-end-submit.php
 * Please tell me how to include the CMB2 to avoid the error.
    I have another request
   regarding frontend, do i need to create new topic?
 * I want to custom taxonomy (category & tags) in frontend. I added new field with
   [taxonomy_select](https://github.com/WebDevStudios/CMB2/wiki/Field-Types#taxonomy_select)
   but its not saving the assigned taxonomy.
 * Thank you.
 *  Plugin Contributor [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [11 years, 1 month ago](https://wordpress.org/support/topic/front-end-post-saving-error/#post-6012974)
 * I wager it’s just a require_once path issue. Take a gander at [https://cloudup.com/cMwAagRgs4R](https://cloudup.com/cMwAagRgs4R).
   I had it working just fine with that quick setup in the screenshot. Only difference
   was the inclusion of “/inc” in the specified path.

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Front end post saving error’ is closed to new replies.

 * ![](https://ps.w.org/cmb2/assets/icon.svg?rev=2866672)
 * [CMB2](https://wordpress.org/plugins/cmb2/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/cmb2/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/cmb2/)
 * [Active Topics](https://wordpress.org/support/plugin/cmb2/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/cmb2/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/cmb2/reviews/)

## Tags

 * [frontend](https://wordpress.org/support/topic-tag/frontend/)

 * 8 replies
 * 2 participants
 * Last reply from: [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * Last activity: [11 years, 1 month ago](https://wordpress.org/support/topic/front-end-post-saving-error/#post-6012974)
 * Status: resolved