Skip to content

Instantly share code, notes, and snippets.

Working from home

Andy Feliciotti someguy9

Working from home
Block or report user

Report or block someguy9

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
someguy9 / get-post-id-by-slug.php
Last active May 26, 2020
Get WordPress post ID by slug
View get-post-id-by-slug.php
$post_data = get_page_by_path('my-post-slug');
$post_id = $post_data->ID;
echo 'The post ID is: '.$post_id;
someguy9 / get-current-post-id.php
Last active May 26, 2020
Get the current post ID in WordPress
View get-current-post-id.php
echo 'The current post ID is: '.get_the_ID();
someguy9 / get-user-id-by-email.php
Created May 26, 2020
Gets the user ID by email in WordPress
View get-user-id-by-email.php
//Get user ID by email
$user_data = get_user_by('email', '');
$user_id = $user_data->ID;
$user_email = $user_data->user_email;
echo 'The user ID for '.$user_email.' is '.$user_id;
someguy9 / logged-in-wordpress-css.css
Created May 15, 2020
CSS to change the background color for logged in users
View logged-in-wordpress-css.css
/* Change the background color for logged in users */
body.logged-in {
background-color: #BEBEBE
someguy9 / disable-wordpress-admin-new-user-notification.php
Created May 14, 2020
Disable the WordPress new user email notification sent to the site admin
View disable-wordpress-admin-new-user-notification.php
//Disable the new user notification sent to the site admin
function smartwp_disable_new_user_notifications() {
//Remove original use created emails
remove_action( 'register_new_user', 'wp_send_new_user_notifications' );
remove_action( 'edit_user_created_user', 'wp_send_new_user_notifications', 10, 2 );
//Add new function to take over email creation
add_action( 'register_new_user', 'smartwp_send_new_user_notifications' );
add_action( 'edit_user_created_user', 'smartwp_send_new_user_notifications', 10, 2 );
View wp-check-user-capability.php
if( current_user_can('manage_options') ) {
echo 'This user can manage WordPress options. (Settings Page)';
someguy9 / replace-dashboard-icon-wp-admin.php
Last active Apr 2, 2020
Adds a custom logo to the top left of the WordPress admin
View replace-dashboard-icon-wp-admin.php
//Adds a custom logo to the top left of the WordPress admin
function smartwp_custom_logo_wp_dashboard() {
echo "<style type='text/css'>
#wpadminbar #wp-admin-bar-wp-logo > .ab-item .ab-icon:before {
background-image: url('" . get_bloginfo('stylesheet_directory') . "/admin-icon.png');
background-size: contain;
background-position: 0 0;
color:rgba(0, 0, 0, 0);
someguy9 / remove-jquery-migrate.php
Created Mar 17, 2020
Remove jQuery migrate from WordPress
View remove-jquery-migrate.php
//Remove jQuery migrate
function smartwp_remove_jquery_migrate( $scripts ) {
if ( !is_admin() && !empty( $scripts->registered['jquery'] ) ) {
$scripts->registered['jquery']->deps = array_diff( $scripts->registered['jquery']->deps, ['jquery-migrate'] );
add_action('wp_default_scripts', 'smartwp_remove_jquery_migrate');
someguy9 / disable-xml-rpc.php
Created Mar 17, 2020
Disable XML-RPC in WordPress
View disable-xml-rpc.php
//Disable XML-RPC
add_filter('xmlrpc_enabled', '__return_false');
someguy9 / enable-svg-upload.php
Created Mar 17, 2020
Enable SVG upload in WordPress
View enable-svg-upload.php
//Enable SVG upload
function smartwp_enable_svg_upload( $mimes ) {
//Only allow SVG upload by admins
if ( !current_user_can( 'administrator' ) ) {
return $mimes;
$mimes['svg'] = 'image/svg+xml';
$mimes['svgz'] = 'image/svg+xml';
You can’t perform that action at this time.