• I’ve set up a shortcode function in functions.php. The shortode prints out text from a specific post.

    add_shortcode('volunteer_info', 'volunteer_info');
    function volunteer_info()
    {
    	global $post;
    	$id = '3295'; //set the post id here
    	$thePost = get_post($id); //get the post
    
    	setup_postdata($thePost); //setup the post
    	the_content(); //print out the content
    }

    The code seems to be working as it should, as the text gets printed on the actual webpage. But annoyingly, each time I type in the shortcode in the adminpanel (HTML tab), and press update the adminpanel crashes with the following error.

    Warning: Cannot modify header information – headers already sent by (output started at /storage/content/42/134142/domain_name/public_html/wp-includes/post-template.php:169) in /storage/content/42/134142/domain_name/public_html/wp-includes/pluggable.php on line 934

    Is there any way of getting rid of this error message?

The topic ‘Shortcode causing error in admin panel, after update’ is closed to new replies.