How To Delete Post Revisions In WordPress
While one-to-many times you felt that the post revisions you have got in hand in your blog are very much useful BUT counting on another side, it is good to clear it up. To do so, simply paste the following snippet in your functions.php file and you are done.
1 2 3 4 |
$wpdb->query( " DELETE FROM $wpdb->posts WHERE post_type = 'revision' " ); |
Snippet Source/Credit: Hardeep Asrani
How To Count Your WordPress Website Blogroll Links
Using the following snippet, you will be able to count your WordPress website blogroll links.
1 2 3 4 5 |
<?php $numlinks = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->links WHERE link_visible = 'Y'"); if (0 < $numlinks) $numlinks = number_format($numlinks); echo $numlinks; ?> |
Snippet Source/Credit: Jeff Starr
How To Modify Size Of Embedded Videos In WordPress
Simply paste the following snippet on your functions.php file and you will be able to modify the size of embedded videos as per your requirements.
1 2 3 4 5 6 |
function mycustom_embed_defaults($embed_size){ $embed_size['width'] = 586; // Adjust values to your needs $embed_size['height'] = 500; return $embed_size; } add_filter('embed_defaults', 'mycustom_embed_defaults'); |
Snippet Source/Credit: Shailan
How To Removing News Feed In WordPress Dashboard
The following snippet will let you remove news feed from your WordPress dashboard.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
add_action('wp_dashboard_setup', 'my_dashboard_widgets'); function my_dashboard_widgets() { global $wp_meta_boxes; // remove unnecessary widgets // var_dump( $wp_meta_boxes['dashboard'] ); // use to get all the widget IDs unset( $wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins'], $wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary'], $wp_meta_boxes['dashboard']['side']['core']['dashboard_primary'] ); // add a custom dashboard widget wp_add_dashboard_widget( 'dashboard_custom_feed', 'News from 10up', 'dashboard_custom_feed_output' ); //add new RSS feed output } function dashboard_custom_feed_output() { echo '<div class="rss-widget">'; wp_widget_rss_output(array( 'url' => 'http://www.get10up.com/feed', 'title' => 'What\'s up at 10up', 'items' => 2, 'show_summary' => 1, 'show_author' => 0, 'show_date' => 1, )); echo "</div>"; } |
Snippet Source/Credit: Smashing Magazine