Skip to content

Tag: wordpress

WordPress Find ID of a Post with a specific meta value

I have about 25,000 posts here (and rising). All of them under a Custom Post Type “lead”. Each post has meta information, including a variable called “uniqid”. this uniqid is a url parameter. now i need the post id where exactly this uniqid exists. Now my question is if there is a way …

Filter results by user role

I have a query that returns the total number of users per a specific meta value (gender), considering only users that are not blocked (user_blocked_access): I have to return only the results for a specific user role: But don’t know where I should adds this part of code. Answer You can add an additional …

Is this code protected for SQL injection?

is this safe enough? Or should it be improved? Is this code protected for SQL injection? (PHP) Answer I take it for granted that $wpdb is from the WordPress project. Then as explained by the documentation, the very purpose of these placeholders is to prevent SQL injections. Hence you can consider your code sa…