Retrieve data from wordpress db via input and put those result in dropdown

In the below code when you press button with the id findschoolname ajax will run. you can change the click event with on change of text box. the below script run ajax. <div class=”col-xs-4″> <div class=”zipcode”>Zip Codes <input type=”text” class=”form-control postcode” name=”postalCode” /> <input type=”button” id=”findschoolname”> </div> <div id=”replacedropwdown”> </div> </div> <script type=”text/javascript”> jQuery(document).ready(function(){ jQuery(“#findschoolname”).click(function(){ … Read more

I cannot find the difference between these wp_capabilities values in wp_usermeta

You’ve posted some serialized arrays. The first entry, a:1:{s:13:”administrator”;s:1;} is corrupted – that’s not a valid serialized array. The second entry, a:1:{s:13:”administrator”;s:1:”1″;} looks like this when unserialized: array ( ‘administrator’ => ‘1’, ) The third entry, a:1:{s:13:”administrator”;b:1;} looks like this when unserialized: array ( ‘administrator’ => true, ) In my setup, capabilities are stored like … Read more

Update multiple rows in one query

I googled a lot the last days and a few times i´ve seen postings that say that the $wpdb->update function doens´t support multiple updates and that this is not well documented. -> Sorry i don´t have links anymore… I think that this is true because i couldn´t get it to work and i found not … Read more

Custom search query by category id

Try this code <?php $args = array( ‘s’ => $_REQUEST[ ‘search’ ], ‘cat’ => ‘category_id’, ‘paged’ => $paged ); // The Query $the_query = new WP_Query( $args ); // The Loop while ( $the_query->have_posts() ) : $the_query->the_post(); //inside the loop the_title(); the_content(); endwhile; // Reset Post Data wp_reset_postdata(); ?> Hope this help

Location of WP default mySQL tables creation file?

The SQL used to create the default tables is located in wp-admin/includes/schema.php inside wp_get_db_schema(): /** * Retrieve the SQL for creating database tables. * * @since 3.3.0 * * @global wpdb $wpdb WordPress database abstraction object. * * @param string $scope Optional. The tables for which to retrieve SQL. Can be all, global, ms_global, or … Read more

WordPress database products structure

To add product, you need to add an entry in posts table, with post_type=”product”, post_title=”product_name”, post_excerpt=”product_description”. This will give you the post ID. with the post ID, you will be able to add meta datas in the post_metas table._product_type, _visibility, _price, _sale_price…. use terms tables to add category related to the product You can see … Read more

Valid SQL query not returning results

Here you’ve did something wrong with $wpdb->table_name. It will only return the default WordPress table names. Not custom table names. And also when you call $wpdb->prepare then pass the parameter as array. So your function will be like below- function get_info($postid) { global $wpdb; // Here I assumed that your table name is ‘{$wpdb->prefix}places_locator’ $sql … Read more

Where do plugin variables live in the db?

Where to store plugin settings in the database is technically up to the plugin developer. I’ve seen some plugins that create custom database tables. The standardized method, however, is to use the WordPress site options table (i.e. wp_options). That’s what will be used if the developer uses the WordPress settings API. You can view a … Read more