Articles of pluggable

Changing the comments link produced by the get_comments_link() and get_comments_pagenum_link() functions

Currently my theme calls upon get_comments_link() to create the standard anchor #comments to link to the comments below the post, as does the get_comments_pagenum_link() function on paginated comments. I would like to replace the #comments anchor in these functions with any other string, without of course changing WP’s core php files. A simple add_filter to […]

Problems with removing admin bar

I am trying to remove the admin bar from a theme front end of a theme. I found the following code block: add_filter( ‘show_admin_bar’, ‘__return_false’ ); remove_action( ‘personal_options’, ‘_admin_bar_preferences’ ); Which works fine. However I wanted to add a choice for the user, so that I can add a permanent code block to my boilerplate […]

Using Default WordPress Custom Header Image Crop Feature in a Post Type / MetaBox

I am not sure how many of you have experimented with the new custom header image functionality of wordpress 3.0 but its actually very cool (enabled by adding the function to your functions.php file). One of the key things which I find to be extremely useful is that it allows you to upload an image […]

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 […]

Nonce generated 0-12 hours ago

In WordPress there’s a nonce generating/verifying mechanism, and I’m having trouble understanding why it’s not working correctly… At a point it checks for whether the nonce was generated 0-12 hours ago. wp-includes\pluggable.php:1260 function wp_verify_nonce($nonce, $action = -1) { $user = wp_get_current_user(); $uid = (int) $user->ID; if ( ! $uid ) $uid = apply_filters( ‘nonce_user_logged_out’, $uid, […]

get_avatar() default image not working as of wp 3.5

As of upgrading to wp 3.5 the get_avatar function started not pulling in my default backup image. This has worked for many years this way and curious to why it would stop. I am using the normal use of the function as this: the $url value is the correct path to my default image found […]

Override pluggable functions in a plugin?

WordPress has a file called pluggable.php which contains a list of functions you can override in your plugin. The problem I am facing (I am overriding wp_authenticate) is for each blog in my network I try to activate this plugin, I get: failure, can’t re-declare wp_authenticate which was previously declared in pluggable.php This somewhat defeats […]

Postman: wp_mail has been declared by another plugin or theme

I need use Postman for send email using SMTP server, but when install show message: Postman: wp_mail has been declared by another plugin or theme, so you won’t be able to use Postman until the conflict is resolved. Well.. I’ve uninstalled all unnecessary plugins. BUt not work. Try search any file use wp_mail, and others […]

Is it possible to override this function/class in a child theme?

Is it possible to override this widget function from a parent theme? I saw this blog, but it dealt with a simpler case. parent class Chocolat_Widget_New_Entrys extends WP_Widget { function __construct() {… function widget( $args, $instance ) {… } add_action( ‘widgets_init’, create_function( ”, ‘return register_widget( “Chocolat_Widget_New_Entrys” );’ ) ); I attempted to use remove_action(‘widgets_init’,’???’); […]

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 […]