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
| SELECT u.user_login, b.domain, b.path, | |
| SUBSTRING_INDEX(SUBSTRING_INDEX(um.meta_value,'"', 2), '"', -1) as role | |
| FROM wp_users u | |
| JOIN wp_usermeta um ON u.ID = um.user_id | |
| JOIN wp_blogs b ON b.blog_id = SUBSTRING(um.meta_key, 4, LENGTH(um.meta_key)-16) | |
| WHERE um.meta_key LIKE 'wp_%_capabilities' | |
| ORDER BY 1 | |
| --https://wordpress.stackexchange.com/questions/127081/sql-query-to-get-list-of-all-users-along-with-their-blogs | |
| -- network admins are in sitemeta |
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
| //https://wordpress.stackexchange.com/questions/106427/using-ajax-with-a-class-file | |
| <script> | |
| jQuery(document).ready(function($) | |
| { | |
| $('#wpse').click(function(e) | |
| { | |
| e.preventDefault(); | |
| var data = { | |
| action: 'process_reservation', | |
| nonce: myAjax.nonce |
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
| class MyPlugin { | |
| function __construct() { | |
| add_shortcode('ShowMsg', [$this,'ShowMsg']); | |
| //add_action( 'admin_menu', [$this,'load_starter_tab'] ); | |
| add_action( 'admin_menu', | |
| function () { | |
| add_menu_page( 'Publications Upload', 'Publications Upload', | |
| 'manage_options', 'ha_pubs_load', [$this,'load_starter']); |
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
| function filter_joblisting_json( $data, $post, $context ) { | |
| $phone = get_post_meta( $post->ID, '_phone', true ); | |
| if( $phone ) { | |
| $data->data['phone'] = $phone; | |
| } | |
| return $data; | |
| } | |
| add_filter( 'rest_prepare_joblisting', 'filter_joblisting_json', 10, 3 ); |
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
| /* | |
| https://wordpress.stackexchange.com/questions/216376/how-do-i-add-a-template-to-a-theme-using-a-plugin | |
| Here is a fairly simple approach I was able to get working within a plugin. You'll want to reference https://developer.wordpress.org/reference/hooks/theme_page_templates/ and https://developer.wordpress.org/reference/hooks/template_include/ as you review the code below. | |
| */ | |
| <?php | |
| //Add our custom template to the admin's templates dropdown | |
| add_filter( 'theme_page_templates', 'pluginname_template_as_option', 10, 3 ); | |
| function pluginname_template_as_option( $page_templates, $this, $post ){ | |
| $page_templates['template-landing.php'] = 'Example Landing Page'; |
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
| function benchmark_request() { | |
| $result = array( 'time' => time() ); | |
| echo json_encode( $result ); | |
| exit; | |
| } | |
| add_action( 'wp_ajax_benchmark_request', 'benchmark_request' ); | |
| add_action( 'rest_api_init', function() { | |
| register_rest_route( 'benchmark/v1', '/benchmark/', array( | |
| 'methods' => 'POST', |
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
| From: https://stackoverflow.com/questions/17687619/is-there-a-way-turn-off-jquery-noconflict-mode-in-wordpress | |
| Is there a way turn off jquery noconflict mode in Wordpress? I don't mean loading an alternative version of jquery or the common workarounds: | |
| jQuery(document).ready(function( $ ) { | |
| }); | |
| or: | |
| (function($) { |
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
| sed -ie 's/utf8mb4_unicode_520_ci/utf8_general_ci/g' mysql.sql | |
| sed -ie 's/CHARSET=utf8mb4/CHARSET=utf8/g' mysql.sql | |
| sed -ie 's/utf8mb4_unicode_ci/utf8_general_ci/g' mysql.sql |
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
| add_action('template_redirect','twilio_check_route'); | |
| function twilio_check_route() { | |
| global $wp; | |
| $path = explode('/',$wp->request); | |
| trace($path); | |
| if (strtolower($path[0])=='safety-forums') { | |
| /* triggered from google connect */ | |
| /* set in the google connect option for redirect on login */ | |
| if (! is_user_logged_in() ) { |
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
| define('FS_METHOD','direct'); |