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 wp1.ID, wp1.post_title, wp1.post_parent, parent_post.post_title AS parent_post_title | |
FROM `wp_posts` AS wp1 | |
INNER JOIN `wp_posts` AS wp2 ON wp1.post_title = wp2.post_title AND wp1.ID != wp2.ID | |
LEFT JOIN `wp_posts` AS parent_post ON wp1.post_parent = parent_post.ID | |
WHERE wp1.post_type = "page" | |
AND wp1.post_status != "trash" | |
AND wp1.ID NOT IN ( | |
SELECT DISTINCT post_id | |
FROM `wp_postmeta` | |
WHERE meta_key = "_fl_builder_draft" OR meta_key = "_fl_builder_data" |
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 a shortcode to list the siblings and children of the current page. | |
* Usage: [list-siblings-and-children] | |
* | |
* @param array $atts Shortcode attributes. | |
* @return string The HTML code to render. | |
*/ | |
function yoko_list_siblings_and_children( $atts ) { | |
global $post; |
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 | |
/** | |
* Wrapper for wp_remote_request() with retry logic. | |
* | |
* @param string $url The URL to make the request to. | |
* @param array $args Optional. An array of HTTP request arguments. | |
* @param array $retry_curl_codes Optional. An array of cURL error codes to trigger a retry. | |
* @param int $max_retries Optional. The maximum number of retries. | |
* @return array|\WP_Error The response or WP_Error on failure. |
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 | |
/** | |
* Updates the avatar of a user based on the user's ID. | |
* | |
* This function downloads an image from an external URL and saves it | |
* as the user's avatar. If the image is not square, it crops it to a | |
* square shape before saving. | |
* | |
* @since 1.0.0 | |
* @access public |
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
DELETE pm | |
FROM wp_postmeta pm | |
LEFT JOIN wp_posts wp ON wp.ID = pm.meta_value | |
WHERE | |
pm.meta_key = "_thumbnail_id" AND | |
wp.ID IS NULL |
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 | |
/** | |
* ACF's serialized data can't be used for sorting posts, | |
* so we're making a more useful copy for the purpose. | |
* | |
* @param int|string $post_id The ID of the post being edited. | |
* @return void | |
*/ | |
function happyhumans_save_plaintext_metadata( $post_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 | |
$bible_books = array( | |
'Genesis' => array( | |
'Gen', | |
'Gn', | |
'Ge', | |
), | |
'Exodus' => array( | |
'Exo', |
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 US Territories to the list of US States in Gravity Forms. | |
* | |
* @param array $states The default list of states. | |
* @return array | |
*/ | |
function filter_us_states( $states ) { | |
// Add American Samoa. |
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
# The plugin relies on a transient for the review count, but it seems like it's not always current. | |
# See if there's a transient saved for post ID 1575 (then delete it to force the recalculation next time the count is displayed). | |
SELECT * | |
FROM `wp_options` | |
WHERE option_name = "_transient_wc_product_reviews_pro_review_count_1575"; |
NewerOlder