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
//Archive Ad Widget Area | |
genesis_register_sidebar( array( | |
'id' => 'archive-ad-widget', | |
'name' => 'Archive Ad Widget', | |
'description' => 'This is for the Archive Ad Widget Area' | |
) ); | |
add_action( 'genesis_after_header', 'sk_archive_ad', 22 ); | |
function sk_archive_ad() { | |
if ( is_category() ) { |
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 | |
/* create this code in a file in the main wordpress directory e.g. delmedia.php | |
and access it via mydomain.com/delmedia.php | |
obviously this can do serious damage | |
set to delete 100 a time to avoid time outs and menatto be run perioidically by cron | |
otherise run directly by php command line and don't worry about limits | |
*/ |
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
private function api_call( $url ) { | |
// a transient is used to store the token, this token in this API expires in 60 minute | |
if ( false === ( $this->api_token = get_transient( 'my_api_token' ) ) ) { | |
$response = $this->api_get_token( $url ); | |
$response_code = wp_remote_retrieve_response_code( $response ); | |
} else { | |
$args = array( | |
'headers' => array( | |
'Authorization' => 'Basic ' . $this->api_token, | |
), |
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
add_action( 'rest_authentication_errors', 'disallow_user_rest_access_to_users' ); | |
function disallow_user_rest_access_to_users( $access ) { | |
if ( ( isset( $_REQUEST['rest_route'] ) && ( preg_match( '/users/', $_REQUEST['rest_route'] ) !== 0 ) ) { | |
return new WP_Error( 'rest_cannot_access', esc_html__( 'No Access to User endpoint REST API.', 'mytext' ), array( 'status' => rest_authorization_required_code() ) ); | |
} | |
return $access; | |
} |
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 | |
/* | |
Plugin Name: My Custom Code | |
Plugin URI: https://fullworks.net/ | |
Description: Custom code plugin | |
Version: 1.0 | |
Author: Alan | |
Author URI: https://fullworks.net/ | |
License: GPL2 | |
* |
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
function restrict_access_if_logged_out(){ | |
if (!is_user_logged_in() ){ | |
$redirect = home_url() . '/wp-login.php?redirect_to=' . get_site_url; | |
wp_redirect( $redirect ); | |
exit; | |
} else { | |
if (!current_user_can('manage_options') && !is_admin()) { | |
show_admin_bar(false); | |
} | |
} |
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 | |
/** | |
* Plugin Name: Redirect Everything to Home | |
* Plugin URI: http://fullworks.net/wordpress-plugins/redirect-404-error-page-to-homepage-or-custom-page/ | |
* Description: Redirect Everything to Home | |
* Version: 1 | |
* Author: Fullworks | |
* Author URI: http://fullworks.net/ | |
* License: GPL-3.0+ |
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
function getSites() { | |
var date = Utilities.formatDate(new Date(), "GMT", "EEE, dd MMM yyyy HH:mm:ss Z"); | |
var secret = 'sk_*****'; | |
var public_key = 'pk_******'; | |
var developer_id = '12**'; | |
var plugin_id = '13**'; | |
var resource_url = '/v1/developers/' + developer_id + '/plugins/' + plugin_id + '/installs.json'; |
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
# multisite search replace | |
wp config set DOMAIN_CURRENT_SITE "multisite.blahnew.net" | |
wp search-replace "multisite.blah" "multisite.blahnew.net" --url=multisite.blah --precise | |
wp search-replace --network "https://multisite.blah.uk" "https://multisite.blahnew.net" --precise --all-tables | |
wp search-replace --network "http://multisite.blah.uk" "https://multisite.blahnew.net" --precise --all-tables | |
# single site | |
wp search-replace --all-tables --precise "http://old" "https://new" | |
wp search-replace --all-tables --precise "http://old" "https://new" |
OlderNewer