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 | |
include(ABSPATH . 'wp-admin/includes/ms.php'); | |
$user = get_userdatabylogin('YOUR_USERNAME'); | |
grant_super_admin($user->ID); | |
?> |
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 | |
// in functions.php | |
add_action('wp_ajax_testing_axaj', 'ajax_function_to_execute', 1, 2); | |
add_action('wp_ajax_nopriv_testing_axaj', 'ajax_function_to_execute', 1, 2); | |
function ajax_function_to_execute() { | |
print_r($_REQUEST); | |
die(); |
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
SELECT | |
cat_posts.ID as ID, | |
cat_posts.post_title as Title, | |
cat_posts.post_date as Published, | |
CASE | |
WHEN cat_term_taxonomy.taxonomy = 'category' THEN GROUP_CONCAT(DISTINCT cat_terms.name SEPARATOR ', ') | |
ELSE "" | |
END | |
as Categories, | |
CASE |
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 do_action('my_do_active_user_message_hook'); where you want the welcome message to display after redirect | |
add_action( 'activate_header', 'check_activation_key_redirect_to_page' ); | |
/** | |
* Check the wp-activate key and redirect the user to the apply page | |
* based on http://www.vanbodevelops.com/tutorials/how-to-skip-the-activation-page-and-send-the-user-straight-to-the-home-page-for-wordpress-multisite | |
*/ | |
function check_activation_key_redirect_to_page() { | |
// We check if the key is not empty |
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
# wordpress-seo provides ability to edit meta information and provides sitemap. | |
# w3-total-cache provides advanced caching no matter the server technology available. | |
# better-wp-security provides brute force protection and a number of WordPress enhancements. | |
# google-analytics-for-wordpress provides robust Google Analytics integration through the Google API. | |
# redirection detects 404s and 301s and allows admins to set up redirects in the WP admin. | |
# ewww-image-optimizer provides automatic optimization of uploaded images with local libraries instead of cloud-based services. | |
# backupwordpress simple backup solution that can store backups above web root. | |
# relevanssi provides better site search using a local index. | |
# cloudflare is the best. Free automatic CDN and security solution. | |
# jarvis is a quick search for the WordPress admin. Indespensible. |
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
# Pantheon's Terminus is awesome, but it can be frustrating when you're first getting used to the syntax. | |
# Some quick tips follow. | |
# | |
# The following applies for Terminus v1.4+ | |
# | |
# When specifying WP CLI commands to run, separate the terminus commands from the wp cli commands with 2 dashes: | |
terminus remote:wp sitename.env -- command-name --flag=value "wp-content/path/to/file-name.ext" | |
# It also helps to wrap paths in double quotes. |
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 // If you'd rather have category drop downs ?> | |
<form action="#" method="get" id="event-change"> | |
<?php | |
$current = get_query_var('tribe_events_cat'); | |
$terms = get_terms($tribe_ecp->get_event_taxonomy()); | |
$count = count($terms); | |
if ( $count > 0 ){ | |
echo '<select class="events-cat-menu"><option value="-1">All Events</option>'; | |
// print_r($terms); | |
$selected = ''; |
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
# Set multiple install paths for phpcs. | |
# This example adds configs for WordPress, Drupal, and PHP compatibility. | |
# NOTE: change `/full/path/to/` to the path to your composer directory. | |
phpcs --config-set installed_paths "/full/path/to/.composer/vendor/wp-coding-standards/wpcs/,/full/path/to/.composer/vendor/drupal/coder/,/full/path/to/composer/vendor/phpcompatibility/php-compatibility/" | |
# Solves the error: PHPCS Response ERROR: Referenced sniff "WordPress-Extra" does not exist. Run "phpcs --help" for usage information |
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
# Test site compatibility with a specific version of PHP. | |
# Requires phpcs and PHPCompatibility config installed. | |
phpcs --standard=PHPCompatibility --runtime-set testVersion 7.2 ./ | |
# Configuration I use most: | |
phpcs -p ./ --standard=PHPCompatibility --runtime-set testVersion 7.2 --report-full=~/petitions-7.2.txt --ignore="*.js|css" |