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: TOPTAL WP-CLI Commands | |
* Version: 0.1 | |
* Plugin URI: https://n8finch.com/ | |
* Description: Some rando wp-cli commands to make life easier... | |
* Author: Nate Finch | |
* Author URI: https://n8finch.com/ | |
* Text Domain: toptal-wpcli | |
* Domain Path: /languages/ |
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 | |
wp_redirection_items.*, | |
wp_redirection_groups.position AS group_pos | |
FROM wp_redirection_items | |
INNER JOIN wp_redirection_groups ON | |
wp_redirection_groups.id=wp_redirection_items.group_id | |
AND wp_redirection_groups.status='enabled' | |
AND wp_redirection_groups.module_id RLIKE 'd' | |
WHERE (wp_redirection_items.regex=1 OR wp_redirection_items.url RLIKE '\/$') |
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
INSERT INTO wp_redirection_items( | |
`url`, | |
`regex`, | |
`position`, | |
`last_count`, | |
`last_access`, | |
`group_id`, | |
`status`, | |
`action_type`, | |
`action_code`, |
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 meta_key, meta_value | |
FROM wp_postmeta | |
WHERE meta_key = "issue_id" | |
But I need to only do posts with a category of | |
UPDATE wp_postmeta SET meta_value = '0' WHERE meta_value = '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
UPDATE wp_postmeta AS a | |
JOIN wp_term_relationships AS b | |
ON a.post_id=b.object_id | |
SET meta_value=0 | |
WHERE term_taxonomy_id = 9 AND meta_key = 'issue_id' AND meta_value != 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
SELECT wp_term_relationships.term_taxonomy_id, wp_term_relationships.object_id, wp_postmeta.post_id, wp_postmeta.meta_key, wp_postmeta.meta_value | |
FROM wp_term_relationships | |
JOIN wp_postmeta | |
ON wp_postmeta.post_id=wp_term_relationships.object_id | |
WHERE term_taxonomy_id = 9 AND meta_key = 'issue_id' AND meta_value != 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
SELECT object_id, term_taxonomy_id | |
FROM wp_term_relationships | |
WHERE term_taxonomy_id = 9; |
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
// Quick type checking in php, outputs to browser console in admin ajax | |
echo 'Type: '. gettype($bc_exists) . "\n"; | |
echo 'Null: '. is_null($bc_exists) . "\n"; | |
echo 'Array: '. is_array($bc_exists). "\n"; | |
echo 'isset: '. is_array($bc_exists). "\n"; | |
echo 'Empty: '. empty($bc_exists). "\n"; | |
echo 'Boolean: '. is_bool($bc_exists). "\n"; | |
echo 'String: '. is_string($bc_exists). "\n"; | |
echo 'Object: '. is_object($bc_exists). "\n"; |
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
//Get Window Screen Width | |
var screenWidth, screenHeight, dialogWidth, dialogHeight, isDesktop; | |
screenWidth = window.screen.width; | |
screenHeight = window.screen.height; | |
if ( screenWidth < 500 ) { | |
dialogWidth = screenWidth * .95; | |
dialogHeight = screenHeight * .95; |
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 the base "/" to the head for pretty routing. | |
add_action( 'wp_head', __NAMESPACE__ . '\add_base_location_provider_to_wp_head' ); | |
function add_base_location_provider_to_wp_head() { | |
echo '<base href="/">'; | |
} |