How to store custom user data on the database?
Do you have any data showing that user meta won’t work? Until you do — don’t mess with it. You are not likely to get from-scratch solutions as convenient and more performant without significant effort.
Do you have any data showing that user meta won’t work? Until you do — don’t mess with it. You are not likely to get from-scratch solutions as convenient and more performant without significant effort.
You want the query to look like this: SELECT email FROM wp_my_users WHERE email=”[email protected]” instead of this: SELECT email FROM ‘wp_my_users’ WHERE email=”[email protected]” So try to construct your query with: $sql = “SELECT email FROM {$my_table_name} WHERE email = %s”; $result = $wpdb->get_var( $wpdb->prepare( $sql, $email_address ) ); where you don’t need to escape the … Read more
You shouldn’t be calling get_the_ID() outside of a post loop, and the post ID is handed to you using the filter as a function argument: function insert_new_table( $post_id ){ So use $post_id Added notes Don’t use mysql_connect etc that extension was deprecated and is no longer included by default in newer versions of PHP. This … Read more
If you have already created the database that you wish to import into and you have selected that database in PHPMyAdmin, but the import file is trying to create a new database, then you will see this error message. All you need to do is open up the SQL file in a text editor and … Read more
I had something similar recently. The context was a store but the model is fairly typical. To greatly simplify, there was a table for Products and another for Serial Numbers (distributed when purchase was completed) to be imported or linked. At first I tried to make Custom Post Types (CPT) fit the model for both. … Read more
I re-ran the following update and now my links work! update wp_posts set post_content = REPLACE(post_content, ‘http://domain.com/wp’, ‘http://domain.com/blog’);
Finally I have been able of import the database succesfully. Because my path is localhost/projects/example and no only localhost, after doing the replace with the plugin I have to manually change some tables path. On wp_blogs and wp_site tables I have: Domain = localhost/projects/example Path = / I have to change to: Domain = localhost … Read more
If you’re trying to get all meta values for a key within a specific post type, you can do something like this in a single query: SELECT post_id, meta_value FROM $wpdb->postmeta pm, $wpdb->posts p WHERE meta_key = ‘sd_rating’ and pm.post_id = p.ID AND p.post_type=”cpu”
The steps to take would be: 1 – Extract files 2 – Create DB and import 3 – modify wp-config.php for database name and user credentials if changed Do not modify db tables to change the site url as they are serialized and this will create more issues than you want to deal with. 4 … Read more
Create an iframe in your post content, and set its source as the google spreadsheet! You’ll probably want to create a shortcode for iframes as they’re stripped out of post content automatically, but there are questions asking how to do that on this site