How to overwrite a JavaScript core function?

You can’t. While manipulation of JS and HTML is possible, it is not adviceable as a long term strategy unless it was explicitly document as “the right way” in the codex, code comment, or some other core document. In addition to the theoretical objection, right now it is hard or almost impossible to override specific … Read more

How to override a function when isn’t at functions.php

The new function in your child theme’s functions.php cannot override a function from the parent’s functions.php file unless that function is written to be pluggable, i.e. declared with if (!function_exists(‘alterna_get_social_list’)) Per the documentation on Child Themes and how they inherit from child functions.php files: Using functions.php Unlike style.css, the functions.php of a child theme does … Read more

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

To add to @EAMann’s answer, you need to wrap your wp_get_current_user() call (or any call that tries to access a function defined within pluggable.php) within the ‘plugins_loaded’ action. So, if you’re putting this inside your functions.php file, do it like this: add_action( ‘plugins_loaded’, ‘get_user_info’ ); function get_user_info(){ $current_user = wp_get_current_user(); if ( !($current_user instanceof WP_User) … Read more

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

There’s actually a filter that you can use, see abstract-wc-email.php, line 214: return apply_filters( ‘woocommerce_email_recipient_’ . $this->id, $this->recipient, $this->object ); you can put the following in your functions.php: add_filter( ‘woocommerce_email_recipient_customer_completed_order’, ‘your_email_recipient_filter_function’, 10, 2); function your_email_recipient_filter_function($recipient, $object) { $recipient = $recipient . ‘, [email protected]’; return $recipient; } the only drawback is that the recipient will see … Read more

How to override parent functions in child themes?

You should run the code after theme setup. function osu_twentyten_continue_reading_link() { return ‘ <a href=”‘. get_permalink() . ‘”>’ . __( ‘Read on <span class=”meta-nav”>&rarr;</span>’, ‘twentyten-child’ ) . ‘</a>’; } function osu_twentyten_auto_excerpt_more( $more ) { return ‘ &hellip;’ . osu_twentyten_continue_reading_link(); } function my_child_theme_setup() { remove_filter( ‘excerpt_more’, ‘twentyten_auto_excerpt_more’ ); add_filter( ‘excerpt_more’, ‘osu_twentyten_auto_excerpt_more’ ); } add_action( ‘after_setup_theme’, ‘my_child_theme_setup’ … Read more

Where can I find a list of WordPress hooks?

@Arlen: As Keith S points out Adam Brown’s List of Hooks is the defacto resource of hooks for WordPress. However, it’s not perfect: It doesn’t show the hooks in order of when they are called, It doesn’t provide file name or line number where invoked, It doesn’t provide a number of arguments passed, It’s not … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)