How to create a database table?

There are several things going on here Firstly, your dbDelta call never receives a CREATE SQL statement. $sql is only defined if the if statement is true, and if your developer environment is setup correctly then running this code should generate PHP Warnings. You’re actually running dbDelta(”); dbDelta already does this check though. It’s not … Read more

Changing an item in drop down after 5 latest posts per taxonomy

Have a closer look to the blow code- $query_args = array( ‘posts_per_page’ => ‘5’, ‘orderby’ => ‘post_date’, ‘order’ => ‘DESC’, ); $listedPosts = new WP_Query($query_args); // the loop if ( $listedPosts->have_posts() ) { while ( $listedPosts->have_posts() ) { $listedPosts->the_post(); if ( (int) $listedPosts->current_post == 5 ) { // You need to use ‘==’ or ‘===’ … Read more

Using $wpdb to insert data into a table

If i understand well, users will update their datas in front-office, and you need to save datas in your custom table. I think you must check on wp_ajax process which will allow you to post datas in JS to a WP_ajax handler. This handler will be a PHP function, (can be written in your theme’s … Read more

Page returns 404 for specific permalink

Check your database, in the postmeta table, for meta_key _wp_old_slug. When you change a slug, WP stores it and automatically redirects the old to the new, which sounds like the reason you initially couldn’t access /locations/. Once you delete the postmeta, visit Settings > Permalinks for good measure (this refreshes permalinks) and try either using … Read more

How do I find out from my database what version of WordPress I need?

Actually, you have a db_version in a “_options” table, also there are information about installed plugins and themes. With information about dates when website was disrupted you can get back to approximate versions of plugins. With these assumptions you can recover the most appropriate version of WP where that version of a plugin works correctly … Read more