wpdb Cannot Update column in Database

First, an observation: the line highlighted below is correct as per your logic? This query will set the dstatus and downloadname fields in a row as $_POST[‘dstatuschange’] and $_POST[‘dlname’] if downloadname field is the ‘dlname’ string. Maybe you wanted to put the $_POST[‘dlname’] variable in your WHERE condition? Second, wordpress custom POSTs work much better … Read more

Connecting to a different database

But I would like to use my secondary database connection like a standard WordPress query, so that all of the query builder functions are available. Unless the other database is a WordPress database, with the exact same table structure, you can’t. The query builder functions in WordPress are designed and built only to work with … Read more

How to get a list of WordPress default database tables?

There is no programmatic way to get a list of default tables. WordPress does not store a list of them anywhere. The closest thing there is is wp_get_db_schema(). This function returns the raw SQL used to create the default tables, but as you can see from the source, it doesn’t derive it from another source, … Read more

I can’t update my data through $wpdb

You’re missing your where statement. You need to tell wpdb which row it should be updating, otherwise you’re looking to insert rather than update. From the $wpdb::update Codex: wpdb->update( string $table, array $data, array $where, array|string $format = null, array|string $where_format = null );

WordPress hook which triggers on post import

If you are trying to fire your function when the WordPress Importer runs, there are a few filters and action hooks available. From the plugin documentation: import_start: occurs after the export file has been uploaded and author import settings have been chosen import_end: called after the last output from the importer https://wordpress.org/plugins/wordpress-importer/

How can I find the cause of a 500 server error?

Okay, here’s what I did. If this happens, hopefully this will work favourably for you. If this is disabled by default, enable wp-debug by changing the value from false to true. Check that you have enabled WP_DEBUG_LOG and WP_LOG_DISPLAY. Try refreshing the page and see what happens. Either using WinSCP or the terminal, go to … Read more