Instantly share code, notes, and snippets.

View Soliloquy WP remove admin notice license expired
// Put this on your theme's functions.php
add_action( 'init', 'q11_remove_soliloquy_license_stuff', 999 );
function q11_remove_soliloquy_license_stuff() {
// Do nothing if Soliloquy is not active.
if ( !class_exists('Soliloquy') && !is_admin() ) {
return;
}
if (is_admin()) {
View wpboss-file-rename-upload.php
<?php
/**
* Plugin Name: WP Boss // Sanitizar nome de arquivo no upload
* Plugin URI: https://www.wpboss.com.br/dicas-truques/renomear-limpar-nomes-arquivos-midia-fazer-upload-wordpress/
* Description: Este plugin renomeia e limpa nomes de arquivos de mídia do WordPress durante o upload.
* Version: 1.0
* Author: João Elton Moreto <john@wpboss.com.br>
* Author URI: https://www.wpboss.com.br/
* License: GPL-2.0+
*/
View wp-404-redirect-valid-slug.php
function q11_redirect_uri_site_antigo() {
if ( is_404() ) {
$url = 'INSERT_YOUR_DOMAIN_HERE' . $_SERVER['REQUEST_URI'];
$end = end(explode('/', rtrim($url, '/')));
if ($end) {
if ( $post = get_page_by_path( $end, OBJECT, array('post', 'page'))) {
$id = $post->ID;
} else {
View post_id_body_class_wp_admin.txt
// Adds the current editing post's ID to body_class in WordPress admin
// Add this code in your theme's funtions.php
function post_id_to_body_admin($pid) {
$screen = get_current_screen();
if ( 'post' == $screen->base ) {
global $post;
$pid .= ' post-id-' . $post->ID;
return $pid;
}
}
View multiple-roles-per-user.php
/**
* Plugin Name: Multiple Roles per User
* Description: Allows anyone who can edit users to set multiple roles per user. In a default WordPress environment that wouldn't have much of an effect, since the user would have the privileges of the top-privileged role that you assign to him. But if you have custom roles with custom privileges, this might be helpful.
* Version: 1
* Author: nikolov.tmw
* Author URI: http://paiyakdev.com/
* License: GPL2
*/
/*
Copyright 2013 Nikola Nikolov (email: nikolov.tmw@gmail.com)