Articles of pluggable

How to override this theme function in child theme

I’m working in a child theme and I need to override a function in order to remove some unwanted items on a top menu. So I have research a bit and found a lot of docs, really, like this, this and this among others but still not clear at all to me how to achieve […]

How to override filter in child theme?

I’m trying to override a parent theme filter in a child theme; I must have the syntax wrong as the override is being completely ignored. Here’s what’s in my child theme’s functions.php: //* remove and replace parent filter function child_remove_parent_function() { remove_filter(‘filter_name’,’parent_function’); } add_filter(‘filter_name’,’child_function’); //* my custom function function child_function($link){ //* function code here return […]

Solution dealing with Child Theme / Parent theme functions

This week I was struggling a bit customizing an exsisting theme for a client. To prevent the theme from being overwritten each update I created a child theme. This allowed me to cusomize most of the files that handled templating. The function which loaded additional stylesheets and js libraries was pluggable and could be overwritten. […]

Bug in pluggable.php?

Can anyone help out here? For several months by now, we start getting problems right after bringing up our website. (we had to restore old pluggable.php to avoid this error) Fatal error: Uncaught exception ‘phpmailerException’ with message ‘Invalid address: ‘ in /home/content/p3pnexwpnas14_data01/89/3058689/html/wp-includes/class-phpmailer.php:946 Stack trace: 0 /home/content/p3pnexwpnas14_data01/89/3058689/html/wp-includes/pluggable.php(352): PHPMailer->setFrom(”, ‘WordPress’) – 1 /home/content/p3pnexwpnas14_data01/89/3058689/html/wp-content/themes/enigma-parallax/header.php(99): wp_mail(‘billmiao.usa@gm…’, ‘You have new […]

Set up functions to be overridden without using function_exists() by short-circuiting them?

A few years ago I read an article about short-circuiting functions with apply_filters() rather than using pluggable functions via function_exists(). I love the idea because of how flexible it is- I’m not limited by when a function can be overridden (plugins, child theme, parent theme), how often, or by naming convention. With this mindset, I’ve […]

overwrite code snippet from parent to child theme

I’m trying to overwrite following code in the child theme. I want to load file /inc/soundtheme-admin.php from child folder. I copied same code snippet in child-theme/functions.php and also copied the inc/soundtheme-admin.php. I also replaced the get_template_directory() to get_stylesheet_directory() but its still loading parent file. Please correct me where I’m making a mistake. Thanks in advance. […]

Form Submission Warning: Cannot modify header error only when plugin is deactivated

I have created some custom post forms that I’m now using in place of a plugin called WP User Frontend which allows you to post and edit from front end. These post forms we’re working great but when I deactivated the plugin I now I get a warning when the post completes its’ upload saying.. […]

Filter a pluggable function

The following function is pluggable as it contains a filter : // Make function pluggable/overwritable if ( ! function_exists( ‘wpsight_layout_images’ ) ) { function wpsight_layout_images() { $layout_images = array( ‘show_on_single’ => true, ‘size_archive’ => ‘post-thumbnail’, ‘align_archive’ => ‘left’, ‘size_single’ => ‘post-thumbnail’, ‘align_single’ => ‘left’, ‘size_widget’ => ‘post-thumbnail’, ‘align_widget’ => ‘left’, ‘size_archive_listings’ => ‘post-thumbnail’, ‘align_archive_listings’ => […]

Overide enqueue in non plugable function via child theme

I am trying to override a non-plugable function using the information on this page but it seems to have no effect. Can anyone see what’s wrong. My code is remove_action(‘wp_print_styles’, ‘az_enqueue_dynamic_css’); function childtheme_dynamic_css() { /* I don’t need to actually add anything so this is just a placeholder */ } add_action( ‘wp_print_styles’, ‘childtheme_dynamic_css’ );

remove_action not removing add_action from constructor

I am trying to replace a message from a function that got hooked in a constructor from a class from woocommerce. This is what I tried to remove the message: What I tried. function remove_actions() { remove_action( ‘product_cat_pre_add_form’, array( ‘WC_Admin_Taxonomies’, ‘product_cat_description’ )); } add_action( ‘plugins_loaded’, ‘remove_actions’ ); Also instead of the first element from array […]