Hot answers tagged

5

Does it need it? Probably not (other than this edge case, props @bravokeyl). Should you add it? In my opinion, yes: From a coding/architecture POV, you're declaring "this file needs WordPress". Any direct hit to one of your theme's files (curious users, bots, "script kiddies" etc.) has the potential to leak a little bit of info (most likely filesystem) and/...


2

After upvoting @pieter's answer.... In recent time I came to the realization that it is much better to handle "bad" data gracefully when it is used (usually it means escaping, but also validation) than at input time. Data corruption can happen not only because of some rouge process "shitting" over your data, but also when the enviroment has changed and the ...


2

Never leave anything to chance, always sanitize, escape and validate all data coming from forms and super globals like $_GET and $_POST according to your requirements and the data type you are expecting. It is always good to set your code up in a way so that should your validation fail, you do not unnecessarily run scripts and functions. Have some kind of ...


2

No, functions.php would generate PHP fatals if loaded directly as it uses the WordPress API. If functions.php tried to bootstrap and load WordPress however, then yes, it would be necessary, but if you've done that then something has gone horribly wrong and you need to start from scratch


2

Most of the times there is no need to check for defined( 'ABSPATH' ) in the child theme.


1

You don't want to be messing around with that. Look at the following hook: https://codex.wordpress.org/Plugin_API/Action_Reference/wp_login You should do something like: function check_test_user() { // Your code here } add_action('wp_login', 'check_test_user'); The hook will run as part of the Login process and saves you modifying core Wordpress files.


1

I had some problem with Mod_Security, login , Rest API (mobile app access), ... You can change roles of Mod_Security


1

Using remove_action() can be remove unnecessary links for example: remove_action('wp_head', 'rsd_link'); //removes EditURI/RSD (Really Simple Discovery) link. remove_action('wp_head', 'wlwmanifest_link'); //removes wlwmanifest (Windows Live Writer) link. remove_action('wp_head', 'wp_generator'); //removes meta name generator. remove_action('wp_head', '...



Only top voted, non community-wiki answers of a minimum length are eligible