Insert all post IDs in new database table

I have a plugin which creates a new database table. Upon activating the plugin is there a way to insert all my posts ids into that table? Right now I’m using an action hook to immediately insert the id of new posts I publish. function transfer_post_id($post_ID) { global $wpdb; if (!($wpdb->get_row(“SELECT post_id FROM $my_table WHERE … Read more

Is it good practice to use wpdb->query() function?

I am using custom php code to perform data insertion, deletion, updating and other tasks. I am able to insert data into a table in two different ways, $wpdb->insert($table_name, array(‘id’ => NULL, ‘name’ => ‘$name’, ’email’ => ‘$email’, ‘city’ => ‘$city’)); and $sql = “INSERT INTO $table_name VALUES(”, ‘$name’, ‘$email’, ‘$city’)”; $wpdb->query($sql); Is it a … Read more

Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation ‘=’

Error message on MySql: Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation ‘=’ I have gone through several other posts and was not able to solve this problem. The part affected is something similar to this: CREATE TABLE users ( userID INT UNSIGNED NOT NULL AUTO_INCREMENT, firstName VARCHAR(24) NOT NULL, lastName VARCHAR(24) NOT NULL, … Read more

Choosing a stand-alone full-text search server: Sphinx or SOLR? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for … Read more

How do I turn off the mysql password validation?

It seems that I may have inadvertently loaded the password validation plugin in MySQL 5.7. This plugin seems to force all passwords to comply to certain rules. I would like to turn this off. I’ve tried changing the validate_password_length variable as suggested here to no avail. mysql> SET GLOBAL validate_password_length=4; Query OK, 0 rows affected … Read more

PHP/MySQL issues when running WP on EC2 cloud [closed]

Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it’s on-topic for WordPress Development Stack Exchange. Closed 10 years ago. Improve this question I am trying to create a wordpress blog on an Amazon EC2 instance. The amazon base image had apache and php … Read more

theme options echoing multiple times

I tried to strip down the Twenty Eleven theme options page and add my own fields correction: I followed a tutorial somewhere, but when I try to echo the data, it comes out multiple times. Here is my theme-options.php: http://pastebin.com/HSZM56jA This is how I am echoing it: <?php $options = get_option(‘gavsiu_theme_options’); echo $options[‘message-primary’]; echo $options[‘message-secondary’]; … Read more