• Resolved phrz

    (@phrz)


    Hi there,

    I’ve added a functions.php to my theme with a simple function for displaying authors.

    <?php
      // display all users with a link to their user page
      function show_authors() {
          global $wpdb;
          $users = $wpdb->get_col("SELECT * FROM $wpdb->users ORDER BY user_nicename");
          foreach($users as $user) {
              $user = get_userdata($user);
              echo '<li><a href="' . get_author_posts_url($user->ID, $user->user_nicename) . '">' . $user->display_name . '</a></li>';
          }
     } ?>

    works fine, however when i went back to login onto my wp-admin interface i got this error

    Warning: Cannot modify header information - headers already sent by (output started at /home/herozero/html/2/wp-content/themes/HZV02IS01/functions.php:1) in /home/herozero/html/2/wp-includes/pluggable.php on line 694

    How can i solve this? And why is wp doing this? It’s not like you need the theme when accessing your admin right?

    Help!

    Thanks in advance…

Viewing 2 replies - 1 through 2 (of 2 total)
  • whooami

    (@whooami)

    you have either gibberish characters, or line breaks (tabs) or spaces before the opening <?php in that file.

    cat or head the file from the command line, you will see them.

    Thread Starter phrz

    (@phrz)

    thanks a lot! it’s fixed.
    there was a tab in front of the <?php tag. as you said.

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

The topic ‘functions.php in theme causes error in wp-admin’ is closed to new replies.