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

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

When you are concatenating string you shouldn't use ;after the method. Also you should close que quotes, call the method, and open again. Try the code below: $listItem .= '<div id="agenda-block-image-responsive" style="' .get_field('speaker-img' ) . '">';


1

function custom_function_redirect() { if ( isset( $_GET[ 'link' ] ) && $_GET[ 'link' ] != '' ) { wp_redirect( $_GET[ 'link' ], 301 ); }else{ die('test'); } } add_action('template_redirect','custom_function_redirect'); Try this it worked for me. For redirection you should hook the function in template_redirect



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