Is there a filter hook that I can use to change how taxonomy term names are displayed?

The dynamic filter “term_{$field}” is probably what you’re looking for, where the field is “name.” One approach is to have an array of names and their pseudonyms, then do a check-and-return on them so they’ll display the replacement. add_filter( ‘term_name’, function( $value ) { $terms = [ ‘old’ => ‘new’, ]; // basic example check, … Read more

OOP: Display warning and deactivate the plugin if PHP version is less than 5.4

Here’s my bare-bones template that I use when creating a plugin with OOP. Feel free to modify to your liking. Template if ( !defined( ‘ABSPATH’ ) ) exit; // Exit if accessed directly if ( !class_exists( ‘MyPluginName’ ) ) { class MyPluginName { public function __construct() { // Call your actions/filters here add_action( ‘tag’, array( … Read more

add_action for lost_password or modify wp-login.php?action=lostpassword

got a working solution, but wordpress first validate the username or email address then my validation takes place.. I have used allow_password_reset filter instead of lostpassword_post action: add_filter( ‘allow_password_reset’, ‘my_password_reset_helper’ ); function my_password_reset_helper($true) { if (isset($_POST[‘g-recaptcha-response’])) { $array = array(‘response’ => $_POST[‘g-recaptcha-response’], ‘userip’ => $_SERVER[‘REMOTE_ADDR’], ‘secret’ => ‘asddfer345gfdg4veg45y34635345’); $result = gcaptcha($array); if (!$result) { return … Read more

How to detect when a user changes their name?

The hook you’re looking for is insert_user_meta. add_filter( ‘insert_user_meta’, function( $meta, $user, $update ) { if( true !== $update ) return $meta; $old_meta = get_user_meta( $user->ID ); if( $old_meta[ ‘first_name’ ] !== $meta[ ‘first_name’ ] ) { //* Do something } return $meta; }, 10, 3 );

Adding Automatically To In WordPress Using Filter Referencing?

You can filter the_content and use preg_replace() to look for instances of <table></table> and then surround them with your <div>. add_action( ‘the_content’, ‘wpse_260756_the_content’, 10, 1 ); function wpse_260756_the_content( $content ) { $pattern = “/<table(.*?)>(.*?)<\/table>/i”; $replacement=”<div class=”table-responsive”><table$1>$2</table></div>”; return preg_replace( $pattern, $replacement, $content ); }