This file contains 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
function bulk_delete_revisions(){ | |
$args = array( 'post_type' =>'revision', 'posts_per_page' => -1, 'post_status' => 'any', 'fields' =>'ids'); | |
$revisions = get_posts( $args ); | |
foreach ($revisions as $revision) { | |
wp_delete_post( $revision, true); | |
} | |
} | |
add_action( 'wp_head', 'bulk_delete_revisions' ); |
This file contains 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
Private Sub CommandButton2_Click() | |
Dim CSVfolder As String, _ | |
XlsFolder As String, _ | |
fname As String, _ | |
wBook As Workbook | |
CSVfolder = "C:\csv\txt\" | |
XlsFolder = "C:\csv\xlsx\" | |
fname = Dir(CSVfolder & "*.txt") |
This file contains 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
//Delete orphaned files in wp-content/uploads that are not wordpress attachments | |
function clean_uploads_from_nonattachments(){ | |
$uploads_dir = wp_upload_dir(); | |
$search = $uploads_dir['basedir']; | |
$replace = $uploads_dir['baseurl']; | |
//You may want to take it by bites if your uploads is rather large (over 5 gb for example) | |
//$uploads_dir = ( $uploads_dir['basedir'] . '/2015/' ); | |
$uploads_dir = ( $uploads_dir['basedir']); | |
$root = $uploads_dir; | |
//Going through directiry recursevely |
This file contains 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_filter( 'the_content', 'attachment_image_link_remove_filter' ); | |
function attachment_image_link_remove_filter( $content ) { | |
$content = | |
preg_replace( | |
array('{<a(.*?)(wp-att|wp-content\/uploads)[^>]*><img}', | |
'{ wp-image-[0-9]*" /></a>}'), | |
array('<img','" />'), | |
$content | |
); | |
return $content; |
This file contains 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
function prevent_image_links() { | |
$image_set = get_option( 'image_default_link_type' ); | |
if ($image_set !== 'none') { | |
update_option('image_default_link_type', 'none'); | |
} | |
} | |
add_action('admin_init', 'prevent_image_links', 10); |
This file contains 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_filter("the_content", "limit_post_content"); | |
function limit_post_content($content){ | |
if (!(is_user_logged_in())){ | |
$content = substr($content, 0, 300); | |
} | |
return $content; | |
} |
This file contains 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
jQuery(function ($) { | |
$(".adsbygoogle").each(function () { (adsbygoogle = window.adsbygoogle || []).push({}); }) | |
}); |
This file contains 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
function add_async_and_defer_attribute($tag, $handle) { | |
//if ( 'adsense' == $handle ) return str_replace( 'src', 'async src', $tag ); | |
//if ( strpos( $tag, 'jquery.js' ) ) return $tag; | |
return str_replace( 'src', 'defer onload="" src', $tag ); | |
} | |
add_filter('script_loader_tag', 'add_async_and_defer_attribute', 10, 2); |
This file contains 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
<?php | |
/* | |
* This function will clean your list of keywords from partially duplicated lines and return just good long-tailed keyword phrases | |
* To learn more about about long-tails in SEO check http://sabrinazeidan.com/long-tail-keywords-for-seo-definition-examples-free-tool/ | |
* Input file format: file.txt, UTF-8 without BOM, one keyword phrase per line | |
* | |
*/ | |
function leave_good_tails($txt_file_url) { | |
$file_headers = @get_headers($txt_file_url); | |
if ($file_headers[0] == 'HTTP/1.0 404 Not Found'){ // or "HTTP/1.1 404 Not Found" etc. |
OlderNewer