I was looking to change the "Wordpress" name in all of my sent mail. In the past I have customized my Wordpress backend to display my desired email. But I have downloaded a new plugin that has altered the email name field. I went to attempt to change it again but this time in the pluggable.php template file.

However things did not go as planned now I have a fatal error:

Fatal error: Call to undefined function _fill_user() in /home/content/61/7791761/html/Portal/wp-includes/pluggable.php on line 199

I need to fix this seems as though it has something to do with the $wpdb variable

 * Retrieve user info by a given field
 * @since 2.8.0
 * @param string $field The field to retrieve the user with.  id | slug | email | login
 * @param int|string $value A value for $field.  A user ID, slug, email address, or      login name.
 * @return bool|object False on failure, User DB row object
function get_user_by($field, $value) {
global $wpdb;

switch ($field) {
    case 'id':
        return get_userdata($value);
    case 'slug':
        $user_id = wp_cache_get($value, 'userslugs');
        $field = 'user_nicename';
    case 'email':
        $user_id = wp_cache_get($value, 'useremail');
        $field = 'user_email';
    case 'login':
        $value = sanitize_user( $value );
        $user_id = wp_cache_get($value, 'userlogins');
        $field = 'user_login';
        return false;

 if ( false !== $user_id )
    return get_userdata($user_id);

 if ( !$user = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->users WHERE $field = %s", $value) ) )
    return false;

_fill_user( $user );

return $user;

3 Answers 3


Don't mess around with changing those files directly. It will break when that file gets changed in an update. Do this instead.

add_filter( 'wp_mail_from', 'override_mail_from_address' );
add_filter( 'wp_mail_from_name', 'override_mail_from_name' );

function override_mail_from_address($email_address) {
    $from_array = explode('@', $email_address);
    $from_address = $from_array[0];
    $from_domain = $from_array[1];

    if (strtolower($from_address) == 'wordpress') {
        $from_address = "myname"; /* Put the email address you want here */

    return ( $from_address . '@' . $from_domain );

function override_mail_from_name($email_name) {
    if (strtolower($email_name) == 'wordpress') {
        $email_name = "My Name"; /* Put the name you want here */

    return ( $email_name );
  • How does Wordpress Update? Is it a manual from the dashboard? Or is it automatically done? The reason I ask this is because I have seen in the dashboard where it ask to update. My plan was to modify Wordpress in the way I wanted to and rarely update and if I did update have all my files backed up. I am still building this concept as you can see, due to the fact I don't have the back up to the pluggable.php file lol To my understanding your solution to my problem is for me to update and use the above code in functions.php?
    – Jusherb
    Commented Jun 12, 2013 at 21:45
  • 1
    I see your initial reasoning, @Jusherb, but trust us, this is a shitty approach that will annoy you very soon. Never change core files. It's much more of a hassle than it will bring in convenience... Commented Jun 12, 2013 at 22:24

If there are hooks in place that will do the job, as in @XIROXAS answer, I think that using those is the best solution, but pluggable.php contains functions that are meant to be overwritten.

If, for example, you want to alter get_user_by, which you mention in the question, just create your own function with that name in a plugin file and it will be used instead of the function from pluggable.php.

Note that :

Pluggable functions are no longer being added to WordPress core. All new functions instead use filters on their output to allow for similar overriding of their functionality.


I suspect that means that these will eventually be deprecated, but that is a guess and they are not currently listed as such and so should still be safe to use.

Now, I can't find _fill_user on my WordPress 3.5.1 at all. I greped the whole thing. I assume it has been removed but can't find precise information on when. The last time I see a reference to it in get_user_by is WordPRess 3.2. At any rate, that function you posted mimics the old version of get_user_by. Compare against the new version.

Whatever has added that pluggable function has added one that does not seem to be compatible with the current WordPress core. It will need to be rewritten to operate without _fill_user

If your pluggable.php itself, and looks like it may, still has that call to _fill_user something has likely gone wrong with an update somewhere and you need to reupload that file. It wouldn't hurt to reupload all of your core files just to be sure you get everything the way it should be.

  • There was a discussion on the wp-hackers mailing list as to why pluggable functions were no longer added and it was due to plugin conflicts, like if two of them both tried to override wp_mail() or something. I don't know of any plan to deprecate everything in the file. Commented Jun 12, 2013 at 21:51
  • @AndrewBartel What do you suggest I do to get rid of the Fatal Error?
    – Jusherb
    Commented Jun 12, 2013 at 21:53
  • 1
    @AndrewBartel : "pluggable" functions have always struck me as being an unstable hack, honestly. I have no doubt they are a source of numerous conflicts. That is why I made a point to say that the filter solutions are the better solutions, if there are filters that will do the job.
    – s_ha_dum
    Commented Jun 12, 2013 at 21:53
  • 1
    @Jusherb I would reupload a fresh copy of pluggable.php and overwrite the broken file if you're unable to find the error. You can extract it from the main download from WordPress.org. Commented Jun 12, 2013 at 22:10

Late answer, but this may help others:

But if your plugin needs a function in pluggables.php (like wp_safe_redirect), then you must manually include_once that file. Otherwise, you get an 'call to undefined function' error for a function that is in that pluggables.php file.

I did it this way

    if ( !function_exists('wp_safe_redirect')) {
        require_once (ABSPATH . WPINC . '/pluggable.php');

Replace the function name (in this case 'wp_safe_redirect') with your needed function.

Perhaps this will save someone the several hours I spent trying to figure that error.

  • pluggable.php is a required file in wp-settings.php - which is always loaded. Pluggable functions aren't available until the plugins_loaded hook. Manually requiring pluggable.php is a bad idea in case another plugin is actually trying to override those functions. The only reason these functions wouldn't exist is because you're trying to use them before plugins_loaded. Commented Feb 7, 2017 at 20:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.