Questions tagged [database]

WordPress stores user generated content, along with other configurable information, in a database (typically MySQL).

Filter by
Sorted by
Tagged with
2
votes
0answers
13 views

Is it safe to delete from db orphaned posts i.e. whose post_parent no longer exists?

I inherited a couple of WP + WooCommerce shops with roughly 30,000 products for sale each, and a wp_postmeta which is over a million lines. The former webmasters ran away. In an effort to clean up old ...
0
votes
1answer
10 views

Does WordPress have something like Drupal's DB API?

That is, the ability to write database queries like: $query = db_select('users', 'u'); $query->condition('u.uid', 0, '<>'); $query->execute(); I'm converting a Drupal site to WordPress, ...
0
votes
0answers
13 views

Cant create table on plugin activation

I am trying to create table on plugin activation, I tried making the same function inside the class and calling it from the constructor, and I tried calling it outside the class and finally i tried to ...
0
votes
1answer
15 views

How to get the full stack trace for WordPress “table doesn't exist” error in debug.log?

I'm getting a WordPress "table doesn't exist" error in my debug.log, but unlike most errors it doesn't give a full stack trace to help me isolate the code. Anyone know how to tell WordPress ...
0
votes
0answers
7 views

Linking a custom application form to database to manage a large user site?

Here's a bitter scenario. Some experts could advice on this for a practical solution. We are in situation that we are building a site with for a growing user base, transactions (user activities) and ...
0
votes
0answers
14 views

Select Image from Media Library and insert into page with responsive markup

I'm building a site for my friend which uses a custom theme and no page builder. The home page has 4 splash images, and to make things as simple as possible for him I'm trying to create some ...
0
votes
0answers
46 views

How to insert a value to decimal type field using wpdb->prepare?

I have a table myTable with a decimal(12,2) field named balance. I want to update the table using the following code. $query = $wpdb->prepare("UPDATE myTable SET balance = %d WHERE id = %d&...
0
votes
1answer
22 views

WPDB: Update table

I am currently developing my first WordPress plugin and am currently a bit confused on how to change a record in a database. So far I have solved it using the $wpdb::update() function: public function ...
0
votes
0answers
13 views

WP Plugin for product RFQ (with both listed and unlisted product ability)

I'm upgrading my old WP website from having static product attribute/variants tables and a basic contact form (which has served me well last 5 years), to a more interactive RFQ (Request For Quote) ...
0
votes
1answer
40 views

Most commented posts by time period (last 12h, last 24h and etc)

I have this code which works great. <?php $result = $wpdb->get_results("SELECT comment_count, ID, post_title FROM $wpdb->posts ORDER BY comment_count DESC LIMIT 0 , 25"); // ...
0
votes
0answers
10 views

DropDown menu link to database and filtered

Morning, I'm doing free integration work for a non-profit organization that also works with people with disabilities. This organization at the regional level promotes and organizes events to which ...
1
vote
0answers
57 views

wp search-replace on database returns PHP fatal error: Array and string offset access syntax with curly braces is no longer supported

So I need to setup a client website locally for improvements. I'm trying to search and replace any instances of the live site's name/url and replace it with a development one. When I run the command: ...
0
votes
0answers
20 views

Whats the best practise on how to store json data from a custom settings page?

I'm creating my first Wordpress Plugin and want to let the user configure multiple urls which he can name and safe as "channels". I've set up a settings page and wanted to store the data ...
0
votes
2answers
74 views

Menu Items disappearing/being empty on save or post edit

I've been having this weird issue on a site for a few weeks now, tried everything I found by searching but still not being able to find a clue of the issue. Whenever I add some items to the Menu (...
1
vote
1answer
23 views

Exporting table to csv works in the admin but exports HTML data when used on the front end

I have some code, implemented by a shortcode within a custom plugin. The code generates a CSV file from some data tables. When I run the shortcode within the admin section, it works perfectly. BUT ...
1
vote
0answers
14 views

How to check if tables in Wordpress still exists after activations

I have problems that my checkIfTablesExists() function is never called, even though I add some fake table name to the list of table names. The reason I want to make this function is to check if the ...
0
votes
0answers
18 views

Real time post display on home page (as soon as they are published)

I have noticed this becoming a trend with comments and now posts. I'm sure many sites (especially community ones) will implement this. Here's exactly what I mean, click here: https://stackexchange.com/...
1
vote
2answers
24 views

Difficulty importing my live site to local

Im using local by flywheel, Here are the steps i have taken so far: Installed local by flywheel and created a site called stage Downloaded the website from CPanel and also the SQL database Imported ...
0
votes
0answers
23 views

Occasional Error Establishing a Database Connection

I have two small WooComm WP sites on Vultr and both of them work for a few days and then I get the old "Error Establishing a Database Connection" error. If I reboot the server they work ...
0
votes
1answer
22 views

Insert Custom Data into wpusers

I add custom row at my wp_users table but the data in the row such as phone_no and ic_no. But when i try to add data, the data not pass in my table This is my code <?php /* Template Name: Register *...
0
votes
0answers
14 views

How to serve a searchable database of more than a million records

I have a database that is current living in a CSV file in my local machine. That database contains around one million entries. An entry looks like the following: NAME SURNAME PLACE_OF_BIRTH ...
0
votes
0answers
19 views

Does this archive template part look like its making too many calls to the db?

I set up a custom post type & taxonomy and registered it as a plugin. Then i'm referencing it from an archive template like this: <?php /* This loop is used in the Archive [.php] template. */ ...
0
votes
1answer
24 views

$wpdb->delete not working for me

I have a function (see in full below) that syncs data into WP from an external database. It's a list of scheduled items. When the schedule is updated, old data should be deleted. See this snippet: $...
0
votes
0answers
15 views

My website is showing today's date instead of published date since db migration to a new wordpress

I exported my database and content to a new Wordpress. Everything works fine, except that every post is showing under today's date, instead of the published date like it should be (the actual ...
0
votes
0answers
12 views

A database for each category?

I thought that wp multisite was ok for my idea to have a network with separated databases but I read that the database is shared. So I wonder if there is something to have one backend and a database ...
0
votes
1answer
23 views

Is There Any Built In WP Functionality For Combining Form Fields To Return Specific Data

I have a basic job board on a site (a custom WP theme) that uses the WP search form to search by keywords in the 'jobs' custom post type, and users can also click on job categories which I have listed ...
0
votes
1answer
21 views

How do I add a medium to the Wordpress database with my own plugin?

I wrote a plugin that accepts files via Wordpress and saves them outside of the server. Now I would like to save the metadata as normal in Wordpress, as if the file were on the server. Is there a hook ...
0
votes
0answers
27 views

Sql query to get all metadata for a post

I have three tables in my database one is users table the other is posts and wp_post meta. In the user table I have all the user details . In the wp_posts table I have different posts types . I want ...
0
votes
0answers
6 views

Recovery - Restore Database after moving folder location locally

I made a bit of an error over the weekend. I moved the local installation of XAMPP and subsequently broke my entire local dev Wordpress install. I have all of the folders intact from XAMPP including ...
0
votes
1answer
18 views

Is it safe to have 2 mysql users?

we have a WooCommerce website and it has a single database. In wp-config.php I setup the connection to the database: user1 name_of_db psw_for_db_user We have an ERP software installed on our office ...
0
votes
0answers
20 views

How optimize website for massive MySQL writing?

I have a website that using plugin RSS Feed Post Generator and there are hundreds post publishing in hours and the MySQL database is busy every time and it cause to heavy loading for main page and ...
1
vote
0answers
11 views

How to replicate a user plugin made table value, to this user's custom meta table value?

I have a plugin that gets a value on user register and stores it in its own automatic made table. I need to set that same value into a usermeta custom meta_value, so the user will be able to see it ...
1
vote
0answers
9 views

how to oauth1 Wp plug-in revoke/reset.?

Am using this plugin to gives access to a app-backend dashboard for android/iOS apps. I authorized it and every thing was fine but apps were not working so for troubleshooting I generated another ...
0
votes
2answers
16 views

Which data is written and stored in the database when read-only (non-posting, non-commenting) users visit the site?

With a default Wordpress install, with no plugin installed, does the read-only visiting of the website generates write operations in the database? By read-only, I mean: visitors come and don't post ...
0
votes
1answer
19 views

Two prefixes in database? Which one is valid?

I am trying to manually migrate an install and have come across this. My DB has some qfo_ prefixed rows and some wpaq_ prefixed rows. The qfo_ are all duplicates of the others (in other words, there ...
0
votes
0answers
24 views

Migrate Users From laravel to wordpress

we used Laravel before , and now we are moving to Wordpress, so we need to migrate all users including the passwords , is this possible? thanks
0
votes
0answers
15 views

Showing logged in user data on the front end

I see there are quite a few answers surrounding this topic, but I can't seem to understand any of them, I am a complete noob when it comes to databases etc. What kind of code do I need if I want to ...
0
votes
1answer
12 views

How to restore an option_value with serialized data from backup data

After changing http to https in several option_values I lost page content. So I reverted the site url back to http and tried to replace an option_value in the wp_options table with data from a recent ...
0
votes
0answers
21 views

WordPress MySQL update

Help me correct this code. public function new_product($product = array()) { if ($product['product_name'] == '') return; global $wpdb; $table_name = $wpdb->prefix . '...
0
votes
0answers
32 views

how to display product price if equal to the value of another query

i want to show the prices of WooCommerce products on my site if the current product ID was equal to the product ID from another query from wp database To better understand my question please see the ...
0
votes
1answer
44 views

Using AND and bracket grouping in SQL not working

I am trying to combine two conditions in a query but it isn't working. but running the conditions independently works. LEt me explain. When I run this query: SELECT DISTINCT SQL_CALC_FOUND_ROWS ...
0
votes
0answers
26 views

Wordpress update databse table

Can anyone explain to me wpdb update database I would like to understand about $where (an array of field name). $table The table name. $data A PHP array where the keys are the columns and the values ...
3
votes
0answers
66 views

Insert custom data to custom table on wordpress database

i need some help here i wanna create some form for user to subscribe our article and store the data to database. i have tried to search it on google, but nothing worked when i tried that. i know that ...
0
votes
1answer
40 views

Realtime database update from 3rd party apps (notion, airtable, sheet, etc)

Can I achieve Realtime database update from spreadsheet? My requirements: I have many posts with custom fields that have certain values. I have all these values stored on a spreadsheet (GoogleSheets, ...
0
votes
0answers
10 views

Collecting data in RafflePress

I'm new to WordPress and I'm using RafflePress to run a giveaway to collect information for marketing, things like first and last name, phone number, and email. How would I be able to collect the data ...
0
votes
1answer
23 views

Join Query on WP_USERMETA Table

I want to check if user time zone is perth and its belong from Group A. MY QUERY IS NOT WORKING SELECT * FROM `wp_users` AS t1 LEFT JOIN wp_usermeta AS t2 ON t1.ID=t2.user_id WHERE t2.meta_key='...
0
votes
1answer
21 views

WordPress has been updated! Before we send you on your way, we have to update your database to the newest version

whenever I attempt to access our production admin panel I get the message below. "Database Update Required WordPress has been updated! Before we send you on your way, we have to update your ...
0
votes
0answers
12 views

How to get the same post_meta-field (custom field) for several different posts, with one database-call

I have the ID of a lot of different posts (50+). And I would like to get the custom field by the name: custom_excerpt for all of these posts, with a single database call. How do I do that? I'm using ...
0
votes
1answer
19 views

Upload media only to DB

I'm using the latest WordPress (5.6) and from what I've found out there's no visible setting for uploading media directly to a DB. Is there such an option somewhere hidden or does WordPress not ...
0
votes
1answer
37 views

Why last row deleted when refresh page

when I refresh page table row deleted and last query deleted when I click on any delete button of other row. Why is this happened? this is table which I displayed <?php ...

1
2 3 4 5
48