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 […]

Categories
WordPress

How to change the WordPress mail sender in 3 lines

Shortly: I needed to change the “sender” of all emails from a blog so every delivery error would have been sent to a specific mailbox. Without installing plugins, the three lines of code needed are: add_action(‘phpmailer_init’, function (PHPMailer $mailer) { $mailer->Sender = ‘bounce@domain.com’; }, 1000); They can be added in the theme functions.php¬† file for […]

Categories
WordPress

Query error: Illegal mix of collations (utf8mb4_unicode_ci,IMPLICIT) and (utf8mb4_unicode_520_ci,IMPLICIT)

This error happens when there are tables on your WordPress installation created with different collations. Here we’re going why that happens. WordPress has a built in feature: if you do not explicitly declare the database collation (how a database should compare strings) it makes some thoughts about it and possible decide to use the new […]

Categories
WordPress

Donations From April 2018 to December 2018

Dear friends, even in the second part of 2018 your generosity has been huge. You all donated 260 euro which, today, have been donated 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 […]

Categories
WordPress

Set NoIndex on WordPress Categories Pages with WordPress SEO

If you need to set to noindex the categories (or generally archives) pages (except the first one), you can add this little snippet of code changing the behavior of WordPress SEO. WordPress SEO has a filter triggered just after the meta robots value has been computed. Intercepting this filter and checking the context, we can […]

Categories
WordPress

Set Canonical To First Page on WordPress Categories Pages and WordPress SEO

To set the rel=canonical pointing to the first page of a paged list in WordPress (for categories or tags) and using WordPress seo you can easily add a filter with a small piece of code.

Categories
WordPress

Related Searches: Is What Google Understand of Me?

When comparing few sites with similar content about pregnancy I found the SERPs on few broad keywords totally ignoring some of them. While few are on first or second page, the others are positioned after the fifth page and the better positioned results (on third or fourth page) are, from a human point of view, […]