Last active
July 3, 2025 03:31
-
-
Save Nodws/768eac8947d06bc5e9ae to your computer and use it in GitHub Desktop.
home and theme dirs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
exec('curl -LO https://wordpress.org/latest.zip; unzip latest.zip '); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Disable login modals introduced in WordPress 3.6 | |
remove_action( 'admin_enqueue_scripts', 'wp_auth_check_load' ); | |
//Disable annoying index redirect | |
remove_filter('template_redirect', 'redirect_canonical'); | |
// Disable useless tags | |
remove_action( 'wp_head', 'rsd_link' ); | |
remove_action( 'wp_head', 'wlwmanifest_link' ); | |
remove_action( 'wp_head', 'wp_generator' ); | |
remove_action( 'wp_head', 'start_post_rel_link' ); | |
remove_action( 'wp_head', 'index_rel_link' ); | |
remove_action( 'wp_head', 'adjacent_posts_rel_link' ); | |
remove_action( 'wp_head', 'wp_shortlink_wp_head' ); | |
// all rubbish related to emojis | |
remove_action( 'admin_print_styles', 'print_emoji_styles' ); | |
remove_action( 'wp_head', 'print_emoji_detection_script', 7 ); | |
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' ); | |
remove_action( 'wp_print_styles', 'print_emoji_styles' ); | |
remove_action('admin_enqueue_scripts', 'wp_auth_check_load'); | |
remove_filter( 'wp_mail', 'wp_staticize_emoji_for_email' ); | |
remove_filter( 'the_content_feed', 'wp_staticize_emoji' ); | |
remove_filter( 'comment_text_rss', 'wp_staticize_emoji' ); | |
// filter to remove TinyMCE emojis | |
add_filter( 'tiny_mce_plugins', 'disable_emojicons_tinymce' ); | |
// Remove useless retina images | |
add_filter( 'wp_calculate_image_srcset_meta', '__return_null' ); | |
add_filter( 'wp_calculate_image_srcset', '__return_false' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action('admin_bar_menu', function($wp_admin_bar) { | |
if (!current_user_can('add_users')) return; | |
global $wpdb; | |
$wp_admin_bar->add_node([ | |
'id' => 'custom_code_snippets', | |
'title' => '<span class="ab-icon dashicons dashicons-editor-code"></span> Snippets', | |
'href' => '#', | |
'meta' => ['class' => 'custom-code-snippets'] | |
]); | |
$snippets = $wpdb->get_results($wpdb->prepare( | |
"SELECT id, name, code FROM {$wpdb->prefix}snippets WHERE active = %d ORDER BY name ASC", 1 | |
)); | |
foreach ($snippets as $snippet) { | |
$prefix = (trim($snippet->code)[0] ?? '') === '<' ? '[html]' : '[php]'; | |
$wp_admin_bar->add_node([ | |
'id' => "snippet-{$snippet->id}", | |
'title' => esc_html("{$snippet->name} {$prefix}"), | |
'parent' => 'custom_code_snippets', | |
'href' => admin_url("admin.php?page=edit-snippet&id={$snippet->id}"), | |
'meta' => ['class' => 'snippet-item', 'title' => 'Code'] | |
]); | |
} | |
foreach (get_posts([ | |
'post_type' => 'elementor_snippet', | |
'numberposts' => -1, | |
'post_status' => 'publish' | |
]) as $esnippet) { | |
$wp_admin_bar->add_node([ | |
'id' => "snippet_{$esnippet->ID}", | |
'title' => esc_html("{$esnippet->post_title} [html]"), | |
'parent' => 'custom_code_snippets', | |
'href' => admin_url("post.php?post={$esnippet->ID}&action=edit&classic-editor"), | |
'meta' => ['title' => 'Elementor'] | |
]); | |
} | |
}, 100); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
define('td', get_bloginfo('template_directory').'/' ); | |
define('hd', esc_url(home_url( '/' ))); | |
//WPconfig | |
$path = ''; //No trail | |
$http = isset($_SERVER['HTTPS']) ? 'https://' : 'http://'; | |
define( 'WP_SITEURL', $http . $_SERVER['SERVER_NAME'] . $path ); | |
define( 'WP_HOME', $http . $_SERVER['HTTP_HOST'] . $path ); | |
define('DB_NAME', $_SERVER['RDS_DB_NAME']); | |
define('DB_USER', $_SERVER['RDS_USERNAME']); | |
define('DB_PASSWORD', $_SERVER['RDS_PASSWORD']); | |
define('DB_HOST', $_SERVER['RDS_HOSTNAME'] . ':' . $_SERVER['RDS_PORT']); | |
define('WP_HTTP_BLOCK_EXTERNAL', true ); | |
define( 'WP_ACCESSIBLE_HOSTS', '*.wordpress.org,*.elementor.com,*.paypal.com' ); | |
define('CORE_UPGRADE_SKIP_NEW_BUNDLED', true); | |
define( 'AUTOSAVE_INTERVAL', 3600 ); | |
define( 'WP_POST_REVISIONS', 9 ); | |
define( 'WP_MAX_MEMORY_LIMIT', '356M' ); | |
//define( 'DISALLOW_FILE_EDIT', true ); | |
define( 'IMAGE_EDIT_OVERWRITE', true ); | |
//define( 'WP_AUTO_UPDATE_CORE', false ); | |
define( 'WP_DEBUG', false ); | |
//ini_set( 'display_errors', 'On' ); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment