WordPress + VS Code PHP Sniffer & Beautifier

To set up you WordPress project locally to work with solid checks for coding standards there are several ways to do it. You could do checks on the repository post push or merge, you could do it in your workspace project with PHP Code Sniffer and finally you do the package setup globally. If you […]

WP Admin User Addition

To quickly add a WordPress user to a site to get access there is a hack possible. This by adding code to theme’s function.php using wp_create_user and set_role

Avoiding Extract() in WordPress

As was decided a long time ago in WordPress extract() should not be used in the case here with shortcode attributes and in general WordPress removed it usage from WordPress core for several reasons. Then there are the times that I can’t find any reference to where a variable came from at all. It’s just […]

Sage 10 Body Class Addition

Body Class

Often you need to add several classes to the body class besides the default classes. We can update the WordPress body class using a filter. In Roots Sage and most themes you have several ways to do this. You could add the filter, use __NAMES_SPACE__ magic constant and then add the function. The value of __NAMESPACE__ is […]

Fatal Error Wordfence Test

default memory only mistake

Our customer experienced an error using Amelia Forms. It would not load properly even though we had added its scripts to the exception list in WP Rocket. So we decided to investigate. The only errors in logs we found were from yesterday and were not related to Amelia but to Wordfence. It seemed it did […]

DreamPress and Oxygen Builder

Oxygen Builder should run on any server that can run WordPress one would assume. And DreamPress does run WordPress websites. They are however not clear on memory on offer at on the pricing pages with specifications. Oxygen Builder is a greedy little bastard memory and requests wise while using the builder to build pages so […]

Oxygen Builder New Style Sheet not loading

At production I had added FAQ based on https://www.youtube.com/watch?v=GTw3rzcPC9k . On staging it worked fine but now on production the newly added FAQstyle CSS added under manage > stylesheets was not loading. So I did the following Emptied WP Rocket cache though I should not need to as I am a logged in user, Regenerated […]

Use Search Icon to Fire Search

If you want an icon to work as your search submission in WordPress you can do this with a basic jQuery script. It is actually not too hard. You just use something like jQuery(‘#fancy_icon-198-4635’).on(‘click’, function() { jQuery(‘#searchsubmit’).click(); }); where on clicking the fancy icon you trigger a search submit click. And that search submit you […]

Body Tag User Role

Sometimes you want to add a body tag for a specific user role. This as you want to hide or show specific parts of a page, or site for a particular user. Here is how you can do just that. add_filter( ‘body_class’, ‘imwz_role__body_class’ ); function imwz_role__body_class( $classes ) { $user = wp_get_current_user(); if ( in_array( […]

Assign Specific Role on Registration

Sometimes you need a custom registration form. A registration form where more fields can be added and where you can assign a specific role based on user input. Plugin Registration Better to put the to be added code in a mu-plugins plugin instead of the theme’s function.php. So let’s start with that. <?php /* Plugin […]