This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Add Async & Defer to certain scripts. | |
* | |
* @param string $tag Script Tags to display. | |
* @param string $handle Name of file specified above. | |
*/ | |
function add_async_defer_attribute( $tag, $handle ) { | |
$scripts = array( 'script-handle' ); | |
foreach ( $scripts as $script ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Add Security Key and appropiate tags Enqueued Scripts & Styles. | |
* | |
* @param string $tag Script Tags to display. | |
* @param string $handle Name of file specified above. | |
*/ | |
function script_security_checks( $tag, $handle ) { | |
$scripts = array( 'script_handle' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define( 'WP_DEBUG', true ); | |
if ( WP_DEBUG ) { | |
define( 'WP_DEBUG_LOG', true ); | |
define( 'WP_DEBUG_DISPLAY', false ); | |
define( 'SCRIPT_DEBUG', true ); | |
define( 'SAVEQUERIES', true ); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (!function_exists('write_log')) { | |
/** | |
* Write to Debug Log with Optional Context | |
* | |
* Logs the provided variable to the PHP error log, always prefixed with the file and line number. | |
* Optionally includes function, class, and call type context if $show_context is true. | |
* | |
* @param mixed $log The content to log (string, array, object, etc). | |
* @param bool $show_context Whether to include function, class, and type context. Default false. | |
* @return void |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
$original = '+44 (0)1234 567 890'; | |
$original = '0044 01234 567 890'; | |
$original = '01234 567 890'; | |
$original = '44 1234 567 890'; | |
Result should always be: +441234567890 | |
*/ | |
// Strip out all characters apart from numbers |