Skip to content

Instantly share code, notes, and snippets.

@graphikuz
graphikuz / gist:60a29dfb8649a92aa4ac
Created August 11, 2014 11:14
Wordpress: Security: Hide login errors
<?php
/**
* Security: Hide login errors
*/
add_filter('login_errors', create_function('$a', "return null;"));
?>
@graphikuz
graphikuz / gist:81c33b801f1638242a12
Created August 11, 2014 11:14
Wordpress: Disable/Limit Number of Post Revisions
<?php
/**
* Disable/Limit Number of Post Revisions
*
*/
# Maximum 5 revisions #
define('WP_POST_REVISIONS', 5);
# Disable revisions #
define('WP_POST_REVISIONS', false);
?>
@graphikuz
graphikuz / gist:65c2582c57874613da3c
Created August 11, 2014 11:06
Wordpress: Change version in WP-Admin footer
<?php
/**
* Change version in WP-Admin footer
*/
function change_footer_version() {
return 'Version 1.0.0';
}
add_filter( 'update_footer', 'change_footer_version', 9999 );
?>
@graphikuz
graphikuz / gist:c2f9c88e864c65baf996
Created August 11, 2014 11:01
Wordpress: Show tag cloud
<?php
/**
* Show tag cloud
*/
wp_tag_cloud(array(
'smallest' => 10, // size of least used tag
'largest' => 18, // size of most used tag
'unit' => 'px', // unit for sizing
'orderby' => 'name', // alphabetical
'order' => 'ASC', // starting at A
@graphikuz
graphikuz / gist:3c46172505a41577447c
Created August 11, 2014 11:00
Wordpress: Check if post is child
<?php
/**
* Check if post is child
*/
function ma_is_child_of($page_id) {
global $post;
$is_child = false;
$parents = get_post_ancestors($post);
if ($parents) {
foreach ($parents as $one_parent_id) {
@graphikuz
graphikuz / gist:730696341a992e0a7131
Created August 11, 2014 10:47
Wordpress: Chage the login logo URL
<?php
/**
* Chage the login logo URL
*/
add_filter( 'login_headerurl', 'my_custom_login_url' );
function my_custom_login_url($url) {
return 'http://www.example.com';
}
?>
@graphikuz
graphikuz / gist:6d41d72ecafec7a0ec47
Created August 11, 2014 10:43
Wordpress: Disable the Visual Editor
<?php
/**
* Disable the Visual Editor
*/
add_filter( 'wp_default_editor', create_function('', 'return "html";') );
?>
@graphikuz
graphikuz / gist:e59bb22ca8267189bda1
Created August 11, 2014 10:38
Wordpress: Disable the Admin Bar
<?php
/**
* Disable the Admin Bar
*/
show_admin_bar(false);
?>
@graphikuz
graphikuz / gist:7a2c69343cbc26f1adf8
Created August 11, 2014 10:36
Wordpress: Disable dashboard widgets
<?php
/**
* Disable dashboard widgets
*/
function remove_dashboard_widgets() {
global $wp_meta_boxes;
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins']);
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_comments']);
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links']);
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now']);
@graphikuz
graphikuz / gist:9e2b5eca6c317b39fd05
Created August 11, 2014 10:33
Wordpress: Remove metaboxes from Posts and/or Pages
<?php
/**
* Remove metaboxes from Posts and/or Pages
*/
function remove_meta_boxes() {
# Removes meta from Posts #
remove_meta_box('postcustom','post','normal');
remove_meta_box('trackbacksdiv','post','normal');
remove_meta_box('commentstatusdiv','post','normal');
remove_meta_box('commentsdiv','post','normal');