Questions tagged [mysql]

MySQL is an open-source, relational database management system.

Filter by
Sorted by
Tagged with
0
votes
1answer
22 views

create new users in db starting at what ID?

I have to create several hundred users using mysql. How do I know which user IDs to give them? I don't want to duplicate already-in-use IDs, so is there a way to check which IDs are safe to use for ...
0
votes
1answer
573 views

Missing latest posts and options after DB migration via phpMyAdmin

The latest posts and options are not appearing after importing the database. I'm missing all the latest posts and the latest Advanced Custom Fields. The export is from the remote server and import to ...
0
votes
2answers
633 views

Cloning blog to localhost via WAMP

How do restore a Wordpress blog (actually, cloning would be the right word) from my server to localhost with WAMP? I backed up my blog with BackUpWordPress and got a .zip file sitename.backup.2012-01-...
4
votes
3answers
4k views

Optimize Multiple Taxonomy Term MySQL Query?

(Moderator's note: Title was originally: "query/database optimisation") I'm written a function for a custom "filter" search panel that allows users to select terms from up to four custom taxonomies. ...
0
votes
1answer
523 views

$wpdb->prepare is not working like mysql_real_escape_string

I'm working on a WordPress plugin and recently I have planned to migrate from SQL to $wpdb. I'm using a method called $wpdb->prepare instead of mysql_real_escape_string but it does not work. Here ...
0
votes
1answer
32 views

Update or insert meta key value - On Duplicate key update

I need to bulk update some meta descriptions and have found that some of the posts don't have them so I need to do an update or insert query. (Once I get this query right I will be creating a temp ...
4
votes
2answers
2k views

simple sql query on wp_postmeta very slow

I have a wordpress installation and I need this query on every post: select post_id, meta_key from wp_postmeta where meta_key = 'mykey' and meta_value = 'somevalue' I have 3M rows on that table, and ...
0
votes
1answer
17 views

Delete a custom field in mysql for all posts with specific category id

Delete a custom field in mysql for all posts with specific category id I am trying to delete all custom fields with the key 'key1' from posts that are in category id '66'. I can delete all custom ...
0
votes
2answers
606 views

how to check for wordpress Query errors

In mysql or mysqli you can add this type of Query: <?php $sql = mysqli_query($con, Insert into database itt (name) VALUES ($name)") or die(mysqli_error($con)); ?> What does wordpress do ...
2
votes
1answer
69 views

Too many datadabse connections - upper ceiling mysql

We run a high traffic blog with around 500 real-time users and 10000 posts. We are hosted by self on VPS - 16gb, 4 core with separate mysql DB server - 4gb, 2 core; both SSD. No problem with hosting ...
0
votes
0answers
16 views

Multisite: search all blogs by custom taxonomy

With multisite, each blog has its own table. I want to create a plugin that will add custom taxonomies to all blogs. I know how to do this. Then I want to create a query to return all posts for a ...
1
vote
2answers
29 views

How can I free up the memory used by update_post_meta?

I've noticed that each call to update_post_meta results in a small increase in my memory usage. Normally, the increase is small enough to not matter. But I'm writing a CSV import function that calls ...
0
votes
0answers
22 views

Login issue in Wordpress

I'm facing currently an issue with my wordpress site, i don't know exactly what happened but when i try to login from /wp-admin i enter my password and i connect, but naturaly after the session dies i ...
0
votes
1answer
679 views

pagination on data fetched using SQL query

I am new with php and word press. I have a question that I am using a sql query in my posts to get data from my data base. Now the problem is that I have huge data on my post and I do not have idea ...
0
votes
1answer
587 views

Add value to array in database

I have a custom database in my WordPress site where I want to save multiple values to one row. Let's say I have an entry: id: auto increment pageid: id of current page time: text (is an array ...
1
vote
0answers
23 views

Return terms from multiple taxonomies using $wpdb

I would be the first to admit that I know next to nothing about SQL queries, but after numerous searches and some trial and error I was able to cobble together a query that returned the results I was ...
0
votes
1answer
675 views

Checking for new message using AJAX and PHP. Server overload?

I wrote a script (it may not be perfect, I'm newbie) to check for new message (using ArrowChat and Buddypress) every X mins. It works good, but I'm worried will it overload my server? It's shared. ...
1
vote
1answer
613 views

Wp query show post by author name or post title or post content

I have to create a search query which allows me to filter all posts where author name and post titles or post content has the word from search textbox. So if i search wordpress it should list all the ...
1
vote
3answers
66 views

$wpdb -> Batch insert from XML File?

Actually im stuck on this! XML-File ~ 140.000 Rows Filesize ~ 9.0 MB LOAD XML INFILE 'file_name' isnt't allowed ( shared hosting! ) The supplier provides a single XML file with quantity and sku. The ...
1
vote
3answers
7k views

MySQL Query to Retrieve Category from wp_posts

Using this query to retrieve all of my posts with a specific post_type SELECT * FROM wp_posts WHERE post_type = 'product'; As described here the category is not in the wp_posts table but in term ...
0
votes
1answer
173 views

Inserting other fields to existing registration form in a WordPress theme

I wanted to add extra fields to my website's registration form but when I test it by creating a new account, the rest of the fields do not update with the registration. It was just Email, Username and ...
0
votes
1answer
7 views

Is a MySQL DATETIME or TIMESTAMP value retrieved through $wpdb in UTC?

I have a custom MySQL table with two columns that look like this: `timestamp_created` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, `datetime_created` DATETIME DEFAULT CURRENT_TIMESTAMP, When retrieving ...
0
votes
1answer
743 views

Custom redirects with using SQL

We have pages with urls like this: http://example.com/?page_id=3&user_id=5 http://example.com/?page_id=6&user_id=9 etc. page_id and user_id located in table MySQL Database. And this table has the ...
0
votes
0answers
39 views

Python Wordpress- ImportError on certain python modules

I created a custom plugin to execute python in wordpress as seen here: Running a python script within wordpress It works well mostly, except certain packages in the python script yields ImportError ...
0
votes
1answer
28 views

Changing root password in PHPMyAdmin for Wordpress Database when going live

Is it a good idea to create a password and make your password secure for your Wordpress database when uploading the database to a third-party web host (going live instead of hosting on localhost) ...
1
vote
1answer
663 views

Separate DB by yearly archive of Wordpress

I have large DB of blog post I already export it by year and wanted to make archive by year doing it on subdomain, like 2012.mysite.com I stack looking for solution on internet, I wondering if their ...
0
votes
2answers
31 views

Setting up Wordpress Locally on WAMP for a new site (with one already)

Here are the steps I took in downloading and setting up WordPress on a WAMP (Windows, Apache2, MySQL, PHP): 1.) Download WAMP Server, here: WAMP Server Installation 2.) Download WordPress on ...
1
vote
1answer
614 views

How to set up an auto delete post?

I want to create a form in which when a front-end sets a date and on that date the post gets automatically deleted. Is it possible?
0
votes
0answers
17 views

Export Custom post + WPML

Hi everybody I have a Main wordpress with 500 custom post type, some of them are in Spanish, some of them in other language through WPML. I need to export them into a new wordpress, but I only ...
0
votes
1answer
1k views

Export Yoast Keywords from MySQL/phpMyAdmin

I'd like to export all focus keywords from Yoast, as we're moving platforms to Craft CMS and using a similar tool, Ethercreative's SEO tool. I'd love a good query to pull these from the database, ...
0
votes
4answers
2k views

Error establishing a database connection - with Debug Data

my site started acting up a few days ago, running the debug I get these lines. Tried to mess around with the DB but couldn't get my head through it. Do you have any idea what those lines imply? ...
0
votes
0answers
11 views

sql query page listing with option selected

I want to separate a page page from the sql query. for example current page and last page with option selected. my listing page code <ul class="list-group"> <h2 class="h3">...
0
votes
1answer
28 views

Get url of product's images (woocommerce)

What happen when a post (product) didnt have a guid,because it has the same image with another product ? For example: Query1: select guid from wp_posts where post_type='attachment' and ...
1
vote
1answer
679 views

Connect to MySQL using Windows Authentication

Is it possible to have Wordpress/PHP connect to my MySQL database using Windows Authentication on IIS? I can connect just fine using the normal MySQL command line utilities. I get the following error ...
0
votes
0answers
80 views

PHP Fatal error: Uncaught Error: Call to a member function insert() on null

Hi I have an error that it's: Call to a member function insert() on null that the function $wpdb->insert(); returns. Now, this is my array:  Array ( [title] => Huqvarna 610 cross blocco ...
1
vote
0answers
47 views

Is it safe to convert tables from MyISAM to InnoDB?

I have inherited a WP site (with WP5.1 and WooCommerce 2.6.14, LearnDash 2.5.4 and few other smaller plugins). From screenshot you can see that it is a mix and match of MyISAM and InnoDB tables. ...
1
vote
1answer
875 views

Replacing mysql_escape_string in a custom plugin when moving to PHP7

I have a custom developed plugin for a wordpress website that is an online car community on php5.6. I didn't develop the site originally but am now the custodian. I have limited programming ...
1
vote
2answers
834 views

How to import a custom MySQL DB table into a WordPress custom post type

What I've done so far is create a plugin that creates a custom post type, takes a field(ID from the custom DB) and also creates a couple of page templates. I have a custom MySQL DB that is on the ...
0
votes
1answer
1k views

How to add a custom field and incrementing value for all the published posts

I'm trying to add a custom field value "article" and auto - increment value starting from 1 for all the published and new post starting from the first post. I'm trying with the below code in Mysql. ...
0
votes
1answer
739 views

live site do not update after importing sql database

My live website is not updating after importing sql database from wamp local server until last time all went perfect but last night I was not able to see the changes live made in local. what I did: -...
0
votes
1answer
1k views

MySQL query for taxonomy-meta

I am working directly with MySQL, using MySQL workbench. Can you help me write a SQL query that will pull all custom taxonomies and their term-meta fields? I have a custom taxonomy called(slug) ...
0
votes
2answers
26 views

Why when I create a new post I found 2 record related to this post into the posts database table?

I am very new in WordPress development and I have a doubt about the WP database table named posts I have observe that when I create a new post (into the WP administration panel) are created 2 record ...
0
votes
1answer
45 views

PHP Warning: Error while sending QUERY packet

I have woocommerce website which give database error from 4-5 days. I checked the error log, the error is: PHP Warning: Error while sending QUERY packet. PID=31071 in /home/goldenwiggles/...
0
votes
2answers
1k views

How to pass username into form that sends data to database

I am trying to pass username to database through form: [insert_php] $current_user= wp_get_current_user(); $id= $current_user->user_login; [/insert_php] <input type="hidden" name="id" value="[...
0
votes
1answer
66 views

PHP 7.2.18 | Your PHP installation appears to be missing the MySQL extension which is required by WordPress

I'm getting this message running PHP 7.2.18 Edit: If it makes any difference, when I run PHP from the command line using php -v, it says I'm running 7.3.5 I run this command to install: apt-get ...
0
votes
1answer
23 views

A $_POST should occur when submit form but is not?

When I make a modification to data that is read into a form using MYSQL, I want to apply those changes to the database. But even when successfully submitting a form, the $_POST values are not ...
0
votes
1answer
36 views

I can't update my data through $wpdb

I am trying to update my sql data through $wpdb, but can't... If anyone can help what's the real issue? $updated_version = $wpdb->update('wp_visitors', array('views' => $updated), array( '%d' ))...
0
votes
1answer
25 views

Trouble running $wpdb->query() with last_insert_id

I am trying to get a primary key from a coupon table to put it in my target table as a foreign key. In between I would like to run a query to get the last insert id. I can't get the syntax right ...
0
votes
1answer
898 views

Update post meta data (custom field) by post link

I have a post in my WordPress website, which has lot of custom fields. I have an Excel sheet with "post link" - "custom field data" combination. That custom field (video URL) is already set for each ...
0
votes
1answer
927 views

wp_insert_user is not working for me?

I have written a code for inserting wordpress user if I try to add new user I am getting an error for wp_insert_user like below : "Catchable fatal error: Object of class WP_Error could not be ...