Skip to main content

All Questions

Filter by
Sorted by
Tagged with
346 votes
108 answers
169k views

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

As with many others who are now viewing this post, I have been reading various blogs, forums, and discussion groups to learn and improve my WordPress skills. Over the past 12 months I have been on a ...
15 votes
2 answers
52k views

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

Before I ask this question, I know there is a (legitimate) hesitation to answer questions here about Woo products since they have their own support and their users should be encouraged to use that. I ...
Halle's user avatar
  • 269
11 votes
4 answers
32k views

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: $...
PAFoster's user avatar
  • 111
4 votes
2 answers
2k views

Editor access to plugin settings

I'm trying to give access to an user with the role Editor to this plugin settings page: https://wordpress.org/plugins/commenter-data/ In the code of this plugin on line 31 of commenter.php there is ...
bryanlewis's user avatar
0 votes
1 answer
32 views

Need to replace Currency Shortforms

I want to replace the currency shorten alphabet, it is currently in M, L and So on. I want to change to indian currency number format like K, L and CR below is code: if(!function_exists('...
Vijay Patil's user avatar
0 votes
1 answer
286 views

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 ...
GreatBlakes's user avatar
0 votes
1 answer
732 views

How to add custom function to pluggable.php

I am working on a WP plugin and I want to add a custom function to pluggable.php (located in /wp-includes). I am calling that function from admin.php (located in /wp-admin) eg. Consider the function ...
Alex's user avatar
  • 25
0 votes
1 answer
99 views

pluggable function in theme, to be overridden by plugin

Is it possible to add a function in functions.php like this: // ACF if ( !function_exists('get_field') ) { function get_field() { return false; } } and then let ...
Malibur's user avatar
  • 589
0 votes
1 answer
6k views

overwrite a plugin function in functions.php

need to customise a plugin function but would rather not edit the plugin itself so updates wont remove the custom changes. function iss in a class called UserAccessManager and the function is; ...
v3nt's user avatar
  • 1,689