js/css updating when making a plugin

This isn’t really a WordPress issue. It’s just how browsers cache styles and scripts so that it doesn’t need to download them again. Renaming the file means the browsers treat them as new files and re-download them. That being said, WordPress does offer a way to get around this issue. But firstly, you should properly … Read more

Access first name and last name from user_register

The Codex is always a good place to look for things. Check out this https://codex.wordpress.org/wp_get_current_user Where you will find this sample code: <?php $current_user = wp_get_current_user(); /** * @example Safe usage: * $current_user = wp_get_current_user(); * if ( ! $current_user->exists() ) { * return; * } */ echo ‘Username: ‘ . $current_user->user_login . ‘<br />’; … Read more

Why is an action callback function from an instance of a class always invoking the same function from an instance?

It’s possible I’m misunderstanding your question, but the way it is written it seems as though every instance of your FilterBuilder class will always get called. Each instance of your class has in its constructor: add_action(‘wp_ajax_myfilter’, array($this, ‘filter_function’)); (as well as the non-logged-in-user version) There is no conditional here telling it when to run based … Read more

How can sanitize $_FILES[‘haq_slider’] field

You don’t say where this code is running – for users or just for admins. Here are a few tips, taken heavily from this article on Wordfence. The first check you can run is current_user_can to see if the current user is allowed to upload files using: if(current_user_can(‘upload_files’)) { …. Next you can use wp_check_filetype … Read more