How to override pluggable function in theme?

All the documentation I’ve encountered discusses overriding pluggable function via your plugin. What if you’re doing theme development instead? My functions.php requires another file that overrides the get_user_by() function, defined in pluggable.php. If I omit the if( function_exists() ) call I get the “Cannot redeclare…” error. If I include the if( function exists() ) call, … Read more

How do I call wp_get_current_user() in a plugin when plugins are loaded before pluggable.php?

The current result is “PHP Fatal error: Call to undefined function wp_get_current_user()” which makes sense, but doesn’t help. I need to use $current_user. Here is the code I’m currently using: $wp->init(); do_action( ‘init’ ); // Check site status $file=”http://xxxxxxxx.com/wp-admin/wp_includes/pluggable.php”; if ( is_multisite() ) { if ( true !== ( $file = ms_site_check() ) ) { … Read more

Adding a second email address to a completed order in WooCommerce [closed]

Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it’s on-topic for WordPress Development Stack Exchange. Closed 7 years ago. Improve this question Before I ask this question, I know there is a (legitimate) hesitation to answer questions here about Woo products since they … Read more

Disable email notification after change of password

I want to disable the email notification if a user or an admin changes the password of a user. After some Googling I came to find that I need to create a plugin and overwrite the wp_password_change_notification function found in pluggable.php. This is the plugin and function: <?php /* Plugin Name: Stop email change password … Read more

Best collection of code for your ‘functions.php’ file [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for … Read more