Hot answers tagged

2

You need to turn WP_DEBUG on in your wp-config.php: define( 'WP_DEBUG', true ); That'll help a lot with working out where that 500 error is coming from. Based on the PHP versions you've mentioned, I'm 99.999% sure that the error is due to a feature that isn't available in PHP 5.2.17. You're probably looking at either shorthand array notation (eg. $array = ...


1

You can use the user_register hook to capture user information after their details are saved to the database.


1

Forget about connecting to your database while WordPress is ready and connected by default. Go after wpdb class for DB-specific tasks. First, call the global $wpdb variable which is the db class, and then use few methods to query your specific custom table. Not sure about the table structure? describe it first: global $wpdb; $table = $wpdb->prefix . "...


1

Looks to me you should be seeking a woocommerce purchase completion hook. This would be when you could add that a donation has been made and at what amount, then you could grab any user information, amounted donated and other info you need and save it to your donor table. use this: add_action('woocommerce_order_status_completed', 'save_to_donors',10,1); ...


1

This action hook allows you to access data for a new user immediately after they are added to the database. The user id is passed to hook as an argument. Not all user meta data has been stored in the database when this action is triggered. For example, nickname is in the database but first_name and last_name. The password has already been encrypted when ...


1

Here's the solution update wp_postmeta set meta_key = 'theme2035_embed' where meta_key = 'video'


1

That's not a good practice trying to connect the DB by your own methods while WP does it for you initially. The problem with this is that I have to declare these variables ($db_host, $db_user, $db_pass, $db_name) inside the plugin source code. All these properties are defined in wp-config.php file, located in the root area. If you were to get ...


1

Why not study about how $wpdb works. Visit https://codex.wordpress.org/Class_Reference/wpdb Here is a example of how to insert data to database using $wpdb <?php global $wpdb; $wpdb->insert( 'table_name_here', array( 'column1' => 'value1', 'column2' => 123 ), array( '%s', '%d' ) ...


1

That is because you're trying to define a property that is already defined, query a table with a wrong name, loop through an integer while you can use get_results instead of query method of $wpdb ... I edited the code, hope it will help with your post duplication process: defined('WP_USE_THEMES') || define('WP_USE_THEMES', false); require_once('wp-load.php'...


1

Ok, so I found the solution to this problem and I thought I'd post it here for anyone else who may stumble upon this question. Turns out I was making this much more difficult than it needed to be. I just added a simple function to the custom site plugin I created (this could also be added to your functions.php file). function hea_cpt_author( $query ) { ...



Only top voted, non community-wiki answers of a minimum length are eligible