Title: Frustrations with upgrading
Last modified: September 1, 2016

---

# Frustrations with upgrading

 *  Resolved [Kilmanagh](https://wordpress.org/support/users/kilmanagh/)
 * (@kilmanagh)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/frustrations-with-upgrading/)
 * I am trying to update an abandoned Custom Post plugin that used metabox 0.9. 
   It looks like metabox was only used to add a meta box array to the Custom Post(
   Add/Edit) section.
 * I have spent a couple days pouring over the documentation that you have published
   and the examples. However, After trying every combination of examples, I cannot
   get any metaboxes to render on the page in question. The old way was simple as
   passing an array. No matter what I do I cannot get it to work.
 * I wanted to avoid posting the 311 lines of code here without asking for permission.
   The problem with the plugin using the old version is that it doesn’t work very
   well with WP 4.6, and the plugin author can no longer update the repository, 
   leaving 1000’s abandoned. Outside of using metabox, I have had great success 
   on getting the plugin updated for the loyal users.
 * I plan on using CMb2 for other projects that will be useful for users, but I 
   can get it to work on this Custom Post Plugin, I should be able to get it working
   on anything.
 * [https://wordpress.org/plugins/cmb2/](https://wordpress.org/plugins/cmb2/)

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

 *  Plugin Contributor [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [9 years, 8 months ago](https://wordpress.org/support/topic/frustrations-with-upgrading/#post-7712003)
 * A pastebin or GitHub Gist link would be handy and we could look over things. 
   Better than pasting all here in a forum post directly. Also gets formatting.
 *  Thread Starter [Kilmanagh](https://wordpress.org/support/users/kilmanagh/)
 * (@kilmanagh)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/frustrations-with-upgrading/#post-7712092)
 * Hi, thank you for the reply.
    This is the original:
 * [http://pastebin.com/B1vgzTxe](http://pastebin.com/B1vgzTxe)
 * The metabox starts at line 201. Obviously I changed require once to the new /
   cmb2 and used the new init. However, I want to provide the clean original code
   for a fresh starting example.
    Thank you!
 *  Plugin Contributor [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [9 years, 8 months ago](https://wordpress.org/support/topic/frustrations-with-upgrading/#post-7712113)
 * Not quite sure why the code, as is, isn’t working out. I did go ahead and start
   conversion to work with CMB2 though. You can see it in the gist below. It only
   covers the first of the two arrays your version inserts into the $meta_boxes 
   array, as I want you to get some hands on experience converting the other 😀
 * [https://gist.github.com/tw2113/f9f5d893c6d0c6134c51d6b8fb80431c](https://gist.github.com/tw2113/f9f5d893c6d0c6134c51d6b8fb80431c)
 * Some notes.
 * 1. Since you set up two different metabox sections, I named the first one `"$
   first"` in my gist. You can rename as you see fit, but you’ll want a 2nd variable
   name for the second metabox.
 * 2. The “pages” argument is now “object_types”. It was a change meant to better
   clarify that argument, and indicate that it could be “post”, “page”, “my_slug”,
   and a variety of other types.
 * 3. Everything above the nested arrays in the “fields” section should be passed
   into the `new_cmb2_box()` function, as an array, and the function’s return value
   assigned to a variable. With that variable, you can start calling the `"add_field()"`
   method, and pass in arrays with the value arguments for each field. Do notice
   that the original code has nested arrays, which isn’t needed any more.
 * 4. The filter to run everything on is different than your original code’s. I 
   don’t know exactly what `"wpfc_meta_boxes"` is or when it’s run, but I was managing
   to succeed with `"cmb2_admin_init"`.
 * Let me know if you have any questions or want to try out an end result on my 
   dev site and confirm saving of data etc.
 *  Plugin Author [Justin Sternberg](https://wordpress.org/support/users/jtsternberg/)
 * (@jtsternberg)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/frustrations-with-upgrading/#post-7712115)
 * Michael’s notes are solid. One thing of note though, `cmb2_admin_init` is an 
   action hook, not a filter, and you’re no longer working with a passed in `$meta_boxes`
   array, but instead registering new metaboxes with the `new_cmb2_box()` funciton,
   and then registering fields to that metabox with the `add_field()` method. You
   do not need to `return` anything from your `wpfc_sermon_metaboxes()` function.
   Michael’s gist is a good example, but you can see more examples in the [example-functions.php](https://github.com/WebDevStudios/CMB2/blob/trunk/example-functions.php)
   file.
 * If you’re interested, I built a Sermon Manager plugin using CMB2 that has some
   pretty robust functionality: [https://github.com/jtsternberg/GC-Sermons](https://github.com/jtsternberg/GC-Sermons)
 *  Thread Starter [Kilmanagh](https://wordpress.org/support/users/kilmanagh/)
 * (@kilmanagh)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/frustrations-with-upgrading/#post-7712126)
 * Michael, thank you! I will look what you have done as soon as I can. Thank you
   again for the response.
 * Justin, I will look at your plugin as well for the future. I donate my time (
   and server) to a quite a few organizations that have tons of sermons already 
   posted.
 * Sermon manager was not chosen because it looked the best, but provided the best
   needs of the churches. I found that the bundled “Sermons” plugins with themes
   to be oblivious of what a sermon custom post should be like. Now that Sermon 
   Manager is outdated, there is a huge vacuum in rather large portion of WP users.
 *  Thread Starter [Kilmanagh](https://wordpress.org/support/users/kilmanagh/)
 * (@kilmanagh)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/frustrations-with-upgrading/#post-7712127)
 * Got it! the key was “object_types”. The problems that everyone had with the original
   metabox went away with cmb2.
 * Now I can update it and see what else this can do! 🙂
 *  Thread Starter [Kilmanagh](https://wordpress.org/support/users/kilmanagh/)
 * (@kilmanagh)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/frustrations-with-upgrading/#post-7712128)
 * Oh wait. One thing that does now work.
 * Using <iframe width=”100%” height=”120″ src=”[https://www.mixcloud.com/widget/iframe/?feed=https%3A%2F%2Fwww.mixcloud.com%2Fshekinah_temple%2Flast-days%2F&hide_cover=1&light=1&#8243](https://www.mixcloud.com/widget/iframe/?feed=https%3A%2F%2Fwww.mixcloud.com%2Fshekinah_temple%2Flast-days%2F&hide_cover=1&light=1&#8243);
   frameborder=”0″></iframe>
 * does not work in ‘textarea’ anymore. There is no validation error, it just will
   not update and the postback will show an empty textarea.
 * So then I tried ‘oembed’ as per the example function using [mixcloud [https://www.mixcloud.com/shekinah_temple/last-days/](https://www.mixcloud.com/shekinah_temple/last-days/)
   width=100% height=120 hide_cover=1 light=1].
 * This does produce a validation error saying mixcloud is not a valid embed code.
   It refers me to the codex which shows.. mixcloud lol.
 *  Plugin Author [Justin Sternberg](https://wordpress.org/support/users/jtsternberg/)
 * (@jtsternberg)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/frustrations-with-upgrading/#post-7712129)
 * oembed is not a shortcode. The oembed fields expect an oembeddable url only, 
   aka: [https://www.mixcloud.com/shekinah_temple/last-days/](https://www.mixcloud.com/shekinah_temple/last-days/)
 *  Thread Starter [Kilmanagh](https://wordpress.org/support/users/kilmanagh/)
 * (@kilmanagh)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/frustrations-with-upgrading/#post-7712145)
 * Thanks for the tip Justin! That is a good feature. I just have to figure out 
   why html is not longer working in textarea for all the folks that are using the
   <iframe>. Mixcloud and Soundcloud gives you two options on the embed. WordPress
   shortcodes and html embeds.
 * I am a .net developer used to similar syntax as php but php is a bit harder to
   troubleshoot has not even PHP Storm has the debugging tools that I am used to.
 *  Thread Starter [Kilmanagh](https://wordpress.org/support/users/kilmanagh/)
 * (@kilmanagh)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/frustrations-with-upgrading/#post-7712154)
 * Stumbled upon [http://hasinhayder.github.io/cmb2-metabox-generator/](http://hasinhayder.github.io/cmb2-metabox-generator/).
   
   Thumbs up on that tool!
 * It is now **textarea_code**…
 *  Plugin Author [Justin Sternberg](https://wordpress.org/support/users/jtsternberg/)
 * (@jtsternberg)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/frustrations-with-upgrading/#post-7712158)
 * An updated version of that generator lives here: [http://willthemoor.github.io/cmb2-metabox-generator/](http://willthemoor.github.io/cmb2-metabox-generator/)

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

The topic ‘Frustrations with upgrading’ 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

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

 * 11 replies
 * 3 participants
 * Last reply from: [Justin Sternberg](https://wordpress.org/support/users/jtsternberg/)
 * Last activity: [9 years, 8 months ago](https://wordpress.org/support/topic/frustrations-with-upgrading/#post-7712158)
 * Status: resolved