Current user in plugin returns NULL

I am currently developing a plugin and I am trying to make use of the $current_user global. class Something { public function __construct() { $this->get_user(); var_dump( $this->user ); } private function get_user() { require_once( ABSPATH . ‘/wp-includes/pluggable.php’ ); $this->user = wp_get_current_user(); } } This actually works. However, I need to call pluggable.php file which shouldn’t … Read more

Do I have to override the wp_mail() pluggable function with writing a plugin?

If I want to override wp_password_change_notification, do I have to write a plugin to do this? It seems to have no effect in functions.php of my theme. The only thing I need to do is change the wording to lower case. if ( !function_exists(‘wp_password_change_notification’) ) : /** * Notify the blog admin of a user … Read more

WordPress how to override function adjacent_posts_rel_link_wp_head() in link-template.php the correct way

I’m quite new to WordPress development. I’m using WordPress 4.9.2. I’m currently working on the following issue. I have several blog categories which have no relation to each other. For example “Our Services” and “News”. Now I want to make sure that the Prev/Next links on each post page are only pointing to Prev/Next within … Read more

change default option in wp_dropdown_categories

I’m using wp_dropdown_categories() to output a dropdown. In default view (without having clicked it) it shows the name of the first category in the list. I’d like it to say “Categories”. Is this possible? Thanks in advance 1 Answer 1 You can use the show_option_all argument: <?php $args = array( ‘show_option_all’ => ‘Categories’ ); wp_dropdown_categories( … Read more

redirect pages with no content, instead of 404 error, using max_num_posts?

I have a site that has changed its pagination structure, resulting in a huge amount of 404 errors (more posts are being shown per page than previously, so there are lots of pages that were once indexed in search engines that are now 404’ing). What I want to do is create a function that will … Read more

How to make gravatar.com avatars conditional?

Problem: I am using custom avatars for registered users and my own locally-hosted image as the default gravatar. I want to stop WordPress making HTTP requests to check for gravatar.com images on every comment. Where my custom avatars are used, the scr result still includes a hashed link to gravatar.com with a redirect appended to … Read more

Customized wp_new_user_notification

Customized wp_new_user_notification I’m kind of inexperienced with it comes to editing WordPress functions, yet i’m currently trying to customize wp_new_user_notification in order to personalize the email that administrators and users receive once they register. I’m aware there’s some plugins that allow this kind of customization, but I would rather spend some more time on a … Read more

Overriding a function in wordpress

A theme that I bought is adding unnecessary inline JS code that is not needed in the front page. /* Scripts – dynamic css */ add_action(‘wp_footer’, ‘upme_custom_scripts’); function upme_custom_scripts(){ require_once upme_path . ‘js/upme-custom-js.php’; } I would like to add to my custom.js file an override so that I dont have to edit the core file … Read more