Moving to another host; which tables to move in a database

I never personally tried this, but your images and posts reside in your {prefix}posts (wp_posts) table. I would also copy {prefix}postmeta (wp_postmeta) over. So copying over those table should do what you want. Keep in mind that this won’t copy your categories and tags (meta), and your comments (comments) they reside in other tables, you … Read more

Adding a Table to the wordpress database

Try: function vw_postcode_checker_create_db () { global $wpdb; // Create Table Name $table_name = $wpdb->prefix . “vw_postcode_checker”; // Write Query to add table to database if ( $wpdb->get_var(“SHOW TABLES LIKE ‘$table_name'”) != $table_name) { $sql = “CREATE TABLE $table_name ( id INTEGER(10) UNSIGNED AUTO_INCREMENT, postcode varchar(250) DEFAULT ” NOT NULL, area varchar(250) DEFAULT ” NOT NULL, … Read more

Creating table with plugin is not working

Your dot and quote notation is funky. Try this: if($wpdb->get_var(“SHOW TABLES LIKE ‘$table_name'” ) != $table_name){ $sql= “CREATE TABLE $table_name ( id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY, firstname VARCHAR(30) NOT NULL, lastname VARCHAR(30) NOT NULL, email VARCHAR(50), reg_date TIMESTAMP );”; require_once (ABSPATH. ‘wp-admin/includes/upgrade.php’ ); dbDelta($sql); }

Custom fields on a virtual page

If you use get_post_meta in the template, that calls get_metadata with meta type post, which contains the filter get_{$meta_type}_metadata, which in this case will be get_post_metadata. There you can check the key and return whatever data you want. function wpd_fake_meta( $meta_data, $object_id, $meta_key, $single ){ if( ‘somekey’ == $meta_key ){ return ‘somefakevalue’; } return null; … Read more

HTML table from shortcode with multiple parameters

I have created an example of how you can achive what you are after: You can use it like this : [itable data=”inv;coin;coinamount;currency#inv;coin;coinamount;currency”] function itable_shortcode( $atts ) { extract( shortcode_atts( array( ‘data’ => ‘none’, ), $atts ) ); $data = explode(‘#’,$data); $output = “”; foreach ($data as $value) { $output .= ‘<tr>’; $in_value = explode(‘;’,$value); … Read more

How can I add data to a custom column in the Users section of the wordpress backend?

manage_users_custom_column is a filter hook, so you should use add_filter() and not add_action(). Which also means you should return the output instead of echoing it. The column name is the second parameter and not the first one — which is the current value for the current column. So try with: function last_name_value($output, $column_name, $user_id) { … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)