WordPress: Restrict direct access to files – Prevent hotlinking
A useful bit of code to prevent files from being accessed (or...
17.Dec.2017 | Code Snippets, Wordpress
Fed up of getting the W3 Validator warning “The type attribute is unnecessary…”?
Here is a handy bit of code to remove the type attributes (and anything else) from WordPress. Add this to your functions.php file and customise. Then you’re good to go!
add_action( 'template_redirect', function(){
ob_start( function( $buffer ){
$buffer = str_replace( array( '', "" ), '', $buffer );
// Also works with other attributes...
$buffer = str_replace( array( '', "" ), '', $buffer );
$buffer = str_replace( array( '', "" ), '', $buffer );
$buffer = str_replace( array( '', "" ), '', $buffer );
return $buffer;
});
});
Coding Tips, Wordpress, Wordpress Function, WordPress Tips
Share
A useful bit of code to prevent files from being accessed (or...
Get the featured image dimensions (width and height) in WordPress. Paste the...
In the early days (2003), WordPress was essentially a blogging tool and...
A nice solution for a custom WordPress Ajax login form without using a plugin. Place this anywhere you would like...
In the early days (2003), WordPress was essentially a blogging tool and quite limited in how you could build with...
If you’re a start up business, a sole trader or a small business, it is inevitable that you are going...