Categories
WordPress

Precheck the notification option on bbPress new topic form

Usually, if you contribute a forum sending a request, you want to know if someone replies. On bbPress you can just activate the notifications on the topic you’re creating. But it comes unchecked by default. And in a world of distracted people, assuming the most of your participant want to know if they set a […]

Categories
WordPress

Hide the subscription toggle on bbPress forums

You may need to disable the subscription to mail notifications connected to a forum. If a forum is really busy and someone, wrongly, subscribe it, she’ll start to receive tons of emails. There is not need to work at the code level to disable the subscription functionality, you can simply hide, with a CSS rule, […]

Categories
WordPress

How To Change the WP Email From Name in 3 Lines

All emails sent by a clean installation of WordPress go out with the sender name “WordPress” and the address “wordpress@yourdomain.com”. Since it’s not so nice to receive emails from a site and see in the sender name “WordPress” it is usually a good choice to change it. I don’t know why WordPress doesn’t make this […]

Categories
WordPress

Donations From January 2019 to November 2019

Dear friends, in the last 11 months 360 euro have been collected with donations and today I’ve sent that money to humanitarian initiative through Medecins Sans Frontieres and Save the Children. Hope the best for you and your families. Hope more and more children can enjoy their life with our little help and have future […]

Categories
WordPress

is_admin() WordPress Function: Misusage

Pay attention and do not use it improperly. The is_admin() function is NOT to check is the current user is an administrator! I saw this error many times and probably I did it myself years ago. The is_admin() function provided by WordPress as core function is not to check if the current user is an […]

Categories
WordPress

Dynamically Disable a Plugin

Is it possible to dynamically “disable” a plugin with a condition determined by some visitor attributes? Like the presence of a cookie? Of course without changing the plugin code! Recently I faced this problem: a rather weight plugin that integrates a chat (and more) in a WP site was make the site itself too slow. […]

Categories
WordPress

The WordPress Plugin Activation Hook

WordPress fires and activation action when a plugin is activated. Or at least it should. To be notified of its activation, a plugin can register itself to that even, using the register_activation_hook() function. There are some background concept that must be clear before start to use that action. It is not always as natural as […]

Categories
WordPress

How To Remove WordPress Admin Notices (When Disturbing)

Sometime you really need to remove the administration notices injected by other themes or plugins from your theme or plugin administration pages. If I can understand that admin notices could be very useful, injecting them indifferently in every admin page could lead to conflicts, specially if injected in other plugin/theme pages. Who injects such notices […]

Categories
WordPress

How to disable the new WordPress block style CSS in 3 lines

If you don’t use the new WordPress blocks, you should avoid to load the block style CSS on your page to optimize the page load speed. Here the three lines you need: add_action(‘wp_print_styles’, function () { wp_dequeue_style(‘wp-block-library’); }, 100); Adding the action with priority 100, it will be executed after the style has been enqueued […]

Categories
WordPress

How to change the WordPress authentication cookie expiration in 3 lines

Never needed to change the standard (2 week) login cookie expiration time of WordPress? Here the 3 line of code you need. add_filter(‘auth_cookie_expiration’, function () { return 365 * 2 * DAY_IN_SECONDS; }); You can add those line in the functions.php file of your theme. DAY_IN_SECONDS is a constant defined by WordPress and represents the […]