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

learn more… | top users | synonyms

0
votes
1answer
15 views

Create a new table on the database and save parameters from a contact form

I have a wordpress function in functions.php which gets parameters from a form I made and gets parameters like IP addresses and UTM tags (from the URL) and sends them to me by email. I want to get ...
0
votes
0answers
18 views

$wpdb how can i save my postmeta table before querying it

This function is in my functions.php file. The query returns the value I'm looking for via phpmyadmin, but only AFTER the function has been run in WordPress. add_action( 'transition_post_status', ...
0
votes
1answer
23 views

Inner join overrides Advanced Custom Fields plugin's get_field

I have this search that I made with inner join and where clause. I no longer get get_field() values, they all return false. How can I get ACF to work again? It must be something silly that I don't ...
0
votes
0answers
8 views

MySQL query in Functions.php using inner join to override/add to search

I'm setting up a radial geo-location search. I have users select a zipcode and a radius to search within. I want to use the regular search site.com?/s=abcd&zipcode=90210&radius=10 I look up ...
1
vote
0answers
11 views

Wordpress Deadlock Error

I see more of this error these days in error_log. I see that someone asked this question here a year ago but no solution. Please advise what is causing this issue. Already, tried deactivating some ...
0
votes
0answers
13 views

Create Database Tables on Plugin Activation hook

My function which have code for table creation function hotel_install() { $path=ABSPATH . 'wp-config.php'; require_once ($path); global $wpdb; $charset_collate = ...
0
votes
0answers
11 views

Is it important to add Engine while importing database?

I am importing wordpress database sql file, but destination phpmyadmin not allowing to add ENGINE and CHARSET, But without that file imported and ENGINE, CHARSET is by default. Please tell me is it ...
1
vote
1answer
30 views

Convert simple SQL Query to WordPress query

I'm trying to 'batch' update the value in my post_parent fields in my wp_posts table. I can do it from within phpmyadmin using the following SQL Query: UPDATE wp_posts SET post_parent = '8' WHERE ...
0
votes
0answers
18 views

jquery is loading js scripts with 1 script for a few sec a good aproach?

so..... I want to make a dynamic table from a mysql query and i've done it successfuly but... I dont like the idea off people being able to look at my script files. Is there anyway to avoid this? My ...
0
votes
0answers
25 views

how to retrieve woocommerce product details based on their category_id using mysql -php

I have to retrieve the product details such as image title,description,image link and price from woocommerce table. I've retrieved the categories with this Query, $result = mysql_query("SELECT ...
0
votes
0answers
9 views

Simple SQL Query in wordpress

I want to write a single SQL Query wordpress table wp_options With field name as option_value For table wp_options field, option_value, where i want to get user_id and its all associated images ...
0
votes
1answer
18 views

Apache Redirect based on WordPress permissions

On our company website, we have two different types of download permissions: One for legacy, one for current. Is there a way for me to code a redirect through Apache that will query MySQL for the ...
0
votes
1answer
24 views

form $_post action value gets truncated after it passes through two forms

There are three pages page1, page2 and page3. When I press submit on my first form on page 1 my group name field can be catched with $_POST['groupname'] in the destination page but in the page 2 I ...
0
votes
0answers
18 views

include custom fields in search sql query

here is my sql query: add_filter( 'posts_where', 'title_filter', 100000, 2 ); function title_filter($where, &$wp_query){ global $wpdb; if(isset($_GET['s'])){ ...
0
votes
0answers
17 views

Passed variable gets undefined variable error on insert on next page

I am passing a variable with $_POST to another page and on the destination page I want to perform an insert operation and want to use that passed value . The variable "$mygroup" is coming from a forms ...
2
votes
1answer
22 views

How to run WordPress across 2 VMs for high availability

Microsoft Azure requires that applications utilize two instances across multiple data centers in order to achieve their "high availability" SLA and ensure your sites don't go down for routine ...
0
votes
1answer
37 views

SQL Error wp_commentmeta - incorrect table definition

I'm trying to import a database and wonder how I can stop getting the following error? "#1075 - Incorrect table definition; there can be only one auto column and it must be defined as a key " ...
0
votes
0answers
6 views

Database level import of featured images and link to posts - How?

I have been attempting to import about 50,000 images into 50,000 posts in WP 4.2.2. The _posts table data is all correctly imported already. I know I need to import to _postmeta table and add new ...
1
vote
2answers
35 views

Database query works fine outside Wordpress

This is my code <?php global $wpdb; $rows = $wpdb->get_results("SELECT `submit_time` AS 'Submitted', max( if( `field_name` = 'Salutation', `field_value` , NULL ) ) AS 'Salutation', max( if( ...
3
votes
1answer
83 views

Use REGEXP in WP_Query meta_query key

I know I can use REGEXP in WP_Query like this: $query = new WP_Query(array( 'posts_per_page' => -1, 'post_status' => 'publish', 'meta_query' => array( array( ...
0
votes
0answers
16 views

Post count is wrong in all categories on backend and frontend

Admin area is showing wrong post count for all the categories (and I have 300+) It's showing more posts than they actually are, even for new categories with no posts at all shows like 5 or more. I ...
0
votes
0answers
17 views

wp_list_table, jquery get the value of the checkbox

Hello i'm trying to make inline edit for my wp_list_table. but i've hit a brick wall. the thing is that each elemement/td is made up off 2 class column example: <td class="name column-name" ...
2
votes
1answer
16 views

WordPress and automated MySQL backups to a different host

I'm having the following setup. A development computer in my local network and a production server with a real internet domain. Developing the PHP/CSS files on my dev computer for my theme is handled ...
0
votes
1answer
14 views

directorypress theme error mysql_error() [closed]

I installed directorypress theme to my wordpress site all works fine except this section " my purchase history" its sql error, but I can't deal with I want to remove this error or hide the link " my ...
0
votes
1answer
34 views

MySQL swap one table for another?

So I have a situation with this WordPress site I'm doing where I have to swap the positions of my featured images. I have two per post thanks to the Multiple Post Thumbnails plugin, but now whatever ...
0
votes
0answers
8 views

Mysql join 2 columns into 1

Hello i could really use a hand here.. the thing is i want to make 2 tables for a project - 1: Shifts: - which has: id, usr_id, date, start_time, end_time, and pending - 2: shifts_extra: - which ...
0
votes
1answer
32 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
9 views

MYSQL ignore categories on Wordpress widget

I have this WP widget that pulls random products from the DB. What I really want is to be able to include just a few products categories (or exclude). Can anyone help me? I appreciate. <?php ...
0
votes
0answers
770 views

#1115 - Unknown character set: 'utf8mb4'

When I Import Mysql from local server to web ser it is showng me error 1115 - Unknown character set: 'utf8mb4' in Creating wordpress wp_comment table CREATE TABLE IF NOT EXISTS `wp_commentmeta` ( ...
-1
votes
1answer
24 views

Replace existing pages with new pages, keep menu links

I basically want a plugin or method that would give the same functionality as 'Enable Media Replace' but for replacing pages and posts, instead of redirecting, or manually editing. I've searched high ...
0
votes
3answers
103 views

Order By Multiple Meta Fields

I have two custom fields: meta_key1 is boolean (0 or 1). meta_key2 is a date value - 20150623 for example. Not all meta_key2 fields have an explicit value. It looks like their being treated as an ...
0
votes
1answer
61 views

Updating with $qpdb->query() always returns 0 rows affected

I'm experiencing an odd situation while running an UPDATE with $wpdb->query(). Given the users table, with columns user_id (Primary Key) and status, and the user 3 existing and with status 0, I ...
0
votes
0answers
21 views

Delete all wordpress posts from db that matches a certain condition

Am trying to delete all posts from wordpress database, that are X days old and have a particular meta key-value attached to it. So simply something like this(pseudo sql): DELETE FROM `wp_posts` ...
0
votes
1answer
18 views

$wpdb returns duplicate posts

I have created a shortcode which shows the posts which were created after the user last logged in. The shortcode is working perfectly fine, but I am not sure why but I am getting 7 duplicate posts. So ...
0
votes
2answers
42 views

Saving custom term value to the database in new table

So I'm trying to save the value of a custom term to my database. The table is created as is the custom term. The code below outputs the text field onto my custom terms page but it just doesn't save ...
0
votes
0answers
29 views

Google-App-Engine[PHP]: Error trying to establish database connection

Hi to whom this may interest, I am finding a problem with the cloudsql as database connection is not being established. I have followed the following site step-by-step ...
0
votes
0answers
23 views

How to fix pagination issue on wordpress

I have a category with 2 subcategories. i have created a custom category template, to show the posts from the subcategories of that category, so it look like that: category page shows: Subcategory ...
0
votes
1answer
27 views

How to fetch all meta_key and meta_value using post_id wihout duplication of post meta using sql query

How to fetch all meta_key and meta_value using post_id wihout duplication of post meta using sql query. This query is repeting the post meta each time . $sql="SELECT * FROM wp_posts LEFT JOIN ...
0
votes
0answers
10 views

get_metadata() vs get_post_meta() vs custom query [duplicate]

I have 27 items of post_meta data that I need to get out in a class that I use through-out my website. Currently I'm using: $this->postMetaData = get_metadata("post", $postID); This returns an ...
0
votes
1answer
72 views

WordPress get pagination on wpdb get_results

How do I gee the numbered pagination of custom wpdb result? below code will show one latest post from each authors in the site. I want to show 20 posts per page with a numbered pagination. $postids ...
0
votes
1answer
31 views

worpress 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
2answers
74 views

Show only one post for each author ( Page loads too slow )

I want to show only one latest post by each author and found this code that it working. However, it takes too long to load the page since I have over 100K authors and 100K posts in database. How can I ...
0
votes
1answer
25 views

Foreach only outputs if id is 0

I'm developing a plugin. On the activation hook i do this: /* Create category */ global $wpdb; $rpdb_category = $wpdb->prefix . "rp_category"; if($wpdb->get_var("show tables like ...
3
votes
1answer
80 views

Query both first_name and last_name from wp_usermeta at the same time

I'm trying to fetch both the first_name and last_name of all users at the same time, using the wpdb-object and the wp_usermeta table. I can't seem to figure out how to get both in the same query. ...
0
votes
2answers
152 views

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

After I upload my website on server, I got that message .. I searched on Internet and I found on Wordpress community this link , I followed the installation steps, the error message gone, but I got ...
0
votes
1answer
36 views

Files on Localhost, Database on Server

With Wordpress, is it possible to work on localhost but have the DB on a server? So that workflow will be: 1) Work on localhost (but connected to remote database) 2) Upload JUST files via ...
5
votes
2answers
144 views

Optimize Wordpress Query that take 5 seconds to execute

I have a large wordpress database: rows in key tables: 730K wp_posts 404K wp_terms 752K wp_term_relationships 27K wp_term_taxonomy 1.8 Million wp_postmeta The issue is that I have a query ...
0
votes
0answers
73 views

Count posts of child category in parent category

Hallo Wordpress Comunity, I need your help. I have a Woocommerce shop site with multiple authors. In the sidebar I want to display a list of woocommerce product categories by author (based on posts ...
0
votes
1answer
47 views

How to remove 'GROUP BY' from SQL query produced from get_posts?

Wordpress, Archive Cateory page. From default WP_Query->get_posts() we are getting something like this: SELECT wp_posts.ID FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts.ID = ...
0
votes
0answers
27 views

wpdb giving different results then query in SQL Editor

I'm trying to read candidates and the relation with expertises from 2 custom tables in my WP Database. This is my WPDB query : $candidates = $wpdb->get_results(" SELECT * FROM ...