This file contains 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 | |
// PHP memory limit for this site | |
define( 'WP_MEMORY_LIMIT', '128M' ); | |
define( 'WP_MAX_MEMORY_LIMIT', '256M' ); // Increase admin-side memory limit. | |
// Database | |
define( 'WP_ALLOW_REPAIR', true ); // Allow WordPress to automatically repair your database. | |
define( 'DO_NOT_UPGRADE_GLOBAL_TABLES', true ); // Don't make database upgrades on global tables (like users) | |
// Explicitely setting url |
This file contains 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
# | |
# This script is executed from a terminal prompt at the root of your MainWP WordPress website. | |
# It uses the same services as WP CLI, so if WP CLI runs, this should also. | |
# | |
# Execute MainWP CLI command to generate a list of all configured sites in MainWP | |
# Pipe output through filter to remove columns 3 and 4 of output. These columns hold the 2 digit site number. Adjust if more than 99 sites. | |
# Pipe that output to get rid of the comment lines in the site listing. | |
# Pipe that output through the SED editor inserting the security scan command at the beginning of the line | |
# Send everything to a shell script to be executed. | |
cd /var/www/capwebwpcare.com/htdocs |
This file contains 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
// Removes the Yoast Metabox for Roles other then Admins | |
// Returns true if user has specific role | |
function check_user_role( $role, $user_id = null ) { | |
if ( is_numeric( $user_id ) ) | |
$user = get_userdata( $user_id ); | |
else | |
$user = wp_get_current_user(); | |
if ( empty( $user ) ) | |
return false; | |
return in_array( $role, (array) $user->roles ); |
This file contains 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_init', function () { | |
// Redirect any user trying to access comments page | |
global $pagenow; | |
if ($pagenow === 'edit-comments.php') { | |
wp_redirect(admin_url()); | |
exit; | |
} |
This file contains 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 | |
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/ | |
/* Change the canonical link for the shop page | |
* Credit: Scott Weiss of somethumb.com | |
* Yoast Doc: https://developer.yoast.com/features/seo-tags/canonical-urls/api/ | |
* Last Tested: Jan 25 2017 using Yoast SEO 6.0 on WordPress 4.9.1 | |
*/ | |
add_filter( 'wpseo_canonical', 'yoast_seo_canonical_change_woocom_shop', 10, 1 ); |
This file contains 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 | |
/** | |
* USAGE: | |
* - Search and replace the `CUSTOM_SITEMAP` string with a lowercase identifier name: e.g., "vehicles", "customer_profiles" | |
* - The `your_alternate_data_source()` function does not exist; it's simply a placeholder for your own function that returns some sort of data array. | |
* - Uses heredocs for inline XML: https://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc | |
*/ | |
/** |
This file contains 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 | |
function filter_default_font_directory( $font_directory ) { | |
$upload_dir = wp_get_upload_dir(); | |
$font_directory = array( | |
'path' => untrailingslashit( $upload_dir['basedir'] ) . '/fonts', | |
'url' => untrailingslashit( $upload_dir['baseurl'] ) . '/fonts', | |
'subdir' => '', | |
'basedir' => untrailingslashit( $upload_dir['basedir'] ) . '/fonts', |
This file contains 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 | |
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/ | |
/* | |
* Replace Disallow with Allow Generated Robots.txt | |
* Credit: Unknown | |
* Last Tested: June 09 2020 using WordPress 5.4.1 | |
*/ | |
add_filter('robots_txt','custom_robots'); |
This file contains 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 | |
/* | |
A simple script to quickly anonymise the users of a WordPress website. | |
It works by replacing all of your existing users with new randomly generated user details. | |
Simply add this file to the root directory of your WordPress installation, then go to <<your website address/>>/anonymise-users.php |
NewerOlder