[Solved] Cannot modify header information – headers already sent in WordPress [duplicate]


add_shortcode("snap", "wpr_snap");
$user_ej = wp_get_current_user();
if ($user_ej->roles[0] == 'contributor')
{ ?>
  <style type="text/css">
    #menu-dashboard, #toplevel_page_wpcf7, #menu-tools 
    {
        display:none;
    }
</style>
<?php }
add_filter(  'gettext',  'change_post_to_portfolio'  );
add_filter(  'ngettext',  'change_post_to_portfolio'  );

isn’t inside a function. So it’s being called as soon as the file loads. This means all output is sent to the screen immediately This stuff should be inside a function which is then called at the right time (like the other bits).

1

solved Cannot modify header information – headers already sent in WordPress [duplicate]