Skip to content

Instantly share code, notes, and snippets.

$reboot
bash: /sbin/reboot: Input/output error
$shutdown -r now
bash: /sbin/shutdown: Input/output error
#
# if the above reboot commands doesn't work try either forced reboot or shutdown
#
@mspalex
mspalex / wp_disable_updates.php
Last active November 21, 2016 15:51
Disable notifications and updates of core Wordpress, Plugins and Themes.
<?php
/* Disable All WP updates: core, plugins themes and notifications */
add_action('admin_menu','wphidenag');
function wphidenag() {
remove_action( 'admin_notices', 'update_nag', 3 );
}
remove_action('load-update-core.php','wp_update_plugins');
add_filter('pre_site_transient_update_plugins','__return_null');
<?php
/*
Dumps all the menus in the dashboard - array printing
to know the slugs and array positions
*/
if (!function_exists('debug_admin_menus')):
function debug_admin_menus() {
global $submenu, $menu, $pagenow;
if ( current_user_can('manage_options') ) { // ONLY DO THIS FOR ADMIN
@mspalex
mspalex / libwww-perl-block-verify.pl
Created May 4, 2016 18:14
Script to verify if .htaccess of a website is blocking Libwww-Perl and the code used to block it from inside .htaccess file.
#!/usr/bin/perl
#******************************************************
#
# THIS SCRIPT IS USED TO VERIFY .HTACCESS LIBWWW-PERL BLOCKING
# you need to add the code to .htaccess to block perl libwww
#
# 1. add the following code to .htaccess
# inside <IfModule mod_rewrite.c> after RewriteEngine On
# like the example bellow
@mspalex
mspalex / redirect_logged_off_users.php
Last active April 26, 2016 18:00
A quick way to redirect logged off users of wordpress, when in site development. used it to redirect to a static webpage, on the same server but only a landing page for informing that is in construction
<?php
/* send logged off users to maintenance - comment to disable*/
/* sometimes reg users sessions expire, need to comment temporarily*/
function maintenance_redirect(){
if( !is_user_logged_in() ){
wp_redirect( site_url( 'em-construcao.html' ), 302 );
exit();
}
}
add_action( 'init', 'maintenance_redirect' );
@mspalex
mspalex / LimitRemovePostRevisions.php
Last active February 10, 2016 17:22
Wordpress - Limit or Remove completely Post Revisions
<?php
// set max post revisions
define(, 5);
//(or)
/** Disable Revision once for all*/
define('WP_POST_REVISIONS', false );
//(or)
@mspalex
mspalex / wp_remove_admin_menus.php
Last active August 19, 2016 15:15
Wordpress - Remove Admin menus - items from wordpress and plugins
<?php
/* Remove admin menus, to prevent access to certain areas like
page editing, plugins and templates
*/
add_action( 'admin_menu', 'remove_menus' );
function remove_menus(){
remove_menu_page( 'edit.php' ); //Posts
remove_menu_page( 'upload.php' ); //Media
remove_menu_page( 'edit.php?post_type=page' ); //Pages
@mspalex
mspalex / wp_customize_login_page.php
Last active August 19, 2016 15:16
Wordpress - Alter login page Logo and corresponding URL
<?php
// Customize the WP Logo, on login page; Replace it with your clients logo
add_action('login_head', 'my_custom_login_page');
function my_custom_login_page() {
echo '<style type="text/css">
h1 a {
background: url('.get_bloginfo('template_directory').'-child/img/logo.png) no-repeat center center !important;
width: 200px !important; }
.login #login_error{
@mspalex
mspalex / wphack3.php
Last active May 7, 2016 15:58
Wodpress - Remove Admin WP Logo and Submenu
<?php
// Code to remove the WP Logo and Submenu from the Admin
add_action( 'wp_before_admin_bar_render', 'remove_logo_and_submenu' );
function remove_logo_and_submenu() {
global $wp_admin_bar;
$wp_admin_bar->remove_menu('wp-logo');
$wp_admin_bar->remove_menu('about');
$wp_admin_bar->remove_menu('wporg');
$wp_admin_bar->remove_menu('documentation');
@mspalex
mspalex / wp_backoffice_foot_msg.php
Last active August 19, 2016 15:13
Wordpress - Customize Backoffice footer messages
<?php
// Remove or Replace the Update WP footer link
add_filter('update_footer', remove_admin_footer_upgrade, 1000);
function remove_admin_footer_upgrade($footer_text =''){
return 'your message';
}
// Remove or Replace the Powered By text
add_filter('admin_footer_text', 'remove_footer_admin');