Created
February 7, 2023 06:59
-
-
Save trueqap/4b1f17f562f67bf03f214254e64ba595 to your computer and use it in GitHub Desktop.
eazydocs-pro fix: eazydocs-pro/includes/functions.php
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
<?php | |
/* PLS | |
function get_post_by_slug($post_slug) { | |
global $wpdb; | |
$post_slug = '%' . $post_slug . '%'; | |
$post = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts LEFT JOIN wp_term_relationships ON wp_posts.ID = wp_term_relationships.object_id WHERE post_name LIKE %s ", $post_slug)); | |
return $post; | |
} | |
*/ | |
function get_post_by_slug($post_slug) | |
{ | |
global $wpdb; | |
$post_slug = '%' . $post_slug . '%'; | |
$post = $wpdb->get_var($wpdb->prepare("SELECT ID FROM {$wpdb->posts} LEFT JOIN {$wpdb->term_relationships} ON {$wpdb->posts}.ID = {$wpdb->term_relationships}.object_id WHERE post_name LIKE %s ", $post_slug)); | |
return $post; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment