Query posts using meta_key

After poking around for a day and half, I found a solution. There was nothing in my theme that was controlling the search result besides the form actions, which were: <!– Search Result Page –> <form action=”<?php echo home_url(“https://wordpress.stackexchange.com/”);?>” method=”get” data-javo-patch-form-for-result> <input type=”hidden” name=”post_type” value=”item”> <input type=”hidden” name=”location” value=”<?php echo $javo_query->get(‘location’);?>” data-javo-sf-location> <input type=”hidden” name=”s” … Read more

problem with sql query in wordpress plugin

I think the problem may be with your wildcards. Because you’re trying to use Wildcards in the prepare, which takes %s, the WPDP doesn’t know the difference between the wildcard % and the placeholder %. Using this answer as reference: How to use wildcards in $wpdb queries using $wpdb->get_results & $wpdb->prepare? You’ll have to double-escape … Read more

Plugin will sort users by usermeta

If you want best practices of the options you listed use the user meta table. Adding a column to the users table would be the worst thing you could do – messing with table structure of default WP tables is a no-no. The other two options would fall somewhere in between – with adding your … Read more

Show popular post by category code

You are running two queries in one. You should only run one, and definitely not with query_posts. You should never ever use query_posts Note: This function isn’t meant to be used by plugins or themes. As explained later, there are better, more performant options to alter the main query. query_posts() is overly simplistic and problematic … Read more

get query() without post content?

If you set the fields argument to ids in your query it will return only post IDs which you can then pass to other functions to fetch the data you need. Though that may save memory at the cost of increasing queries to the database.