Title: Shortcode functionality break after 5.0.2 update
Last modified: July 20, 2017

---

# Shortcode functionality break after 5.0.2 update

 *  Resolved [MDN2014](https://wordpress.org/support/users/mdn2014/)
 * (@mdn2014)
 * [8 years, 10 months ago](https://wordpress.org/support/topic/shortcode-functionality-break-after-5-0-2-update/)
 * I just updated my Yoast plugin to version 5.0.2 on a WordPress install running
   4.8., and I noticed a change in functionality.
 * I have several custom shortcodes defined in my functions.php file. When I edit
   a page that has these shortcodes and I hit the “Update” button, the /wp-admin/
   post.php page reloads. Instead of the WordPress post editor reloading, I get 
   a plain white page with my rendered content (no editor), followed by an error
   as follows…
 * Warning: Cannot modify header information – headers already sent by (output started
   at /[home directory url omitted]/functions.php:548) in /[home directory url omitted]/
   wp-admin/post.php on line 197
 * Line # 548 in my functions.php file is the location of the shortcode definition.
 * I didn’t have this issue before the update. When I turn off the Yoast plugin,
   it goes away and everything functions normally. This conflict appears to be limited
   to editing a page.
 * Let me know if you need further info.

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

 *  [Md Mazedul Islam Khan](https://wordpress.org/support/users/mazedulislamkhan/)
 * (@mazedulislamkhan)
 * [8 years, 10 months ago](https://wordpress.org/support/topic/shortcode-functionality-break-after-5-0-2-update/#post-9339243)
 * This issue typically occurs when the custom shortcodes function isn’t defined
   correctly. Can you please share the relevant shortcodes function that you have
   added to your theme `functions.php` file so that we can take a look?
 *  Thread Starter [MDN2014](https://wordpress.org/support/users/mdn2014/)
 * (@mdn2014)
 * [8 years, 10 months ago](https://wordpress.org/support/topic/shortcode-functionality-break-after-5-0-2-update/#post-9346774)
 * Hello,
 * Sorry for the long delay in the response—the notification fell into my spam folder
   and I just now found it!
 * Here’s an example of a shortcode that breaks. Please do let me know how I might
   edit it to solve this problem….
 * function make_quiz_item($params, $content = null) {
    $current_item = $_GET[‘step’];
   $this_item = $params[‘tag’];
 *  // Set default
    if (! strlen($current_item)) { $current_item = “q1”; }
 *  if ($this_item == $current_item) {
    echo $content; } }
 * add_shortcode(‘quiz-item’, ‘make_quiz_item’);
 * Many thanks!
 *  Thread Starter [MDN2014](https://wordpress.org/support/users/mdn2014/)
 * (@mdn2014)
 * [8 years, 10 months ago](https://wordpress.org/support/topic/shortcode-functionality-break-after-5-0-2-update/#post-9361091)
 * Hello Mazedul,
 * Just a follow-up on this issue. I updated to the latest Yoast (5.1) and I’m still
   seeing the issue. Can you tell me how I’m incorrectly defining the shortcode?
   I’ve tried looking up documentation on creating custom shortcodes, but everything
   I see indicates it’s as simple as defining a custom function and using the add_shortcode
   function. My functions.php file is in a child theme. I hope to hear from you (
   or anyone who might have an answer to this issue).
 * Many thanks!
 *  Thread Starter [MDN2014](https://wordpress.org/support/users/mdn2014/)
 * (@mdn2014)
 * [8 years, 10 months ago](https://wordpress.org/support/topic/shortcode-functionality-break-after-5-0-2-update/#post-9361201)
 * Just a follow-up: I think I figured it out. I’ll post the solution I arrived 
   at here, just in case anyone else has the same issue.
 * Apparently I need to add the functions ob_start(); and return ob_get_clean();
   within my shortcode function like so….
 * function make_quiz_item($params, $content = null) {
    **ob_start();** $current_item
   = $_GET[‘step’]; $this_item = $params[‘tag’];
 * // Set default
    if (! strlen($current_item)) { $current_item = “q1”; }
 * if ($this_item == $current_item) {
    echo $content; } **return ob_get_clean();**}
 * add_shortcode(‘quiz-item’, ‘make_quiz_item’);
 * After I did that, the shortcodes behaved normally when I edit a page with them.
   FYI to anyone else who runs into this same problem!

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

The topic ‘Shortcode functionality break after 5.0.2 update’ is closed to new replies.

 * ![](https://ps.w.org/wordpress-seo/assets/icon-256x256.gif?rev=3419908)
 * [Yoast SEO - Advanced SEO with real-time guidance and built-in AI](https://wordpress.org/plugins/wordpress-seo/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wordpress-seo/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wordpress-seo/)
 * [Active Topics](https://wordpress.org/support/plugin/wordpress-seo/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wordpress-seo/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wordpress-seo/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [MDN2014](https://wordpress.org/support/users/mdn2014/)
 * Last activity: [8 years, 10 months ago](https://wordpress.org/support/topic/shortcode-functionality-break-after-5-0-2-update/#post-9361201)
 * Status: resolved