Articles of database

How to Query Database for posts with certain Taxonomy Term

I want to write a select query to return data on only posts which have are associated with the taxonomy term food-and-beverage SELECT wp_postmeta . * , wp_posts.post_name FROM wp_posts, wp_postmeta, wp_terms, wp_term_relationships WHERE wp_posts.post_type = ‘projects’ AND wp_posts.post_status = ‘publish’ AND wp_posts.ID = wp_postmeta.post_id AND wp_term_relationships.object_id = wp_posts.ID AND wp_term_relationships.term_taxonomy_id = wp_terms.term_id AND wp_terms.slug […]

Modify site URL via functions.php of a theme

My site URL in the database shows sitea.com. Is it possible to change this via functions.php into siteb.com, however still maintaining sitea.com in the database? My current scenario is that I have three developers who work locally and we want to use one database. We all connect to a remote database, however, the URLs from […]

Is it possible to store visitors IPs in wp_postmeta table?

Or in any of the other 11 WordPress tables. I also need to store: submission date, name, contact number in the same table. What approach would be best? A custom table or using a standard table?

How to retrieve the value stored in a multi-dimensional array and SUM the entries?

I’m trying to retrieve multidimensional values stored in user_meta where the meta key is my_posts and the meta_value is : a:3:{i:0;s:2:”23″;i:1;s:2:”20″;i:2;s:1:”9″;} Somewhere in the admin page i want to show the sum of the selected posts which are stored in the value above….

Hello dolly type plugin that allows people to add their own

I am making a plugin that shows a random joke on a custom 404 page via shortcode and it is basically near enough the same as the default hello dolly plugin, where the jokes are hardcoded into the script. I want to be able to allow users to add their own jokes, maybe pulled from […]

Use one WordPress database with multiple instances of one site

Is there a way to use the same database, tables and all, with two different domains? For example, two employees each have thier own subdomain to develop / test with, so there may be two instances of a site: jack.example.com/test_blog/ jill.example.com/test_blog/ however, since the base url is stored in the database, it seems that it […]

How do I add indexes to WordPress Database?

I got a message from Hostgator about my account being suspended because of the load it put on their servers. This is about the fifth time this has happened. I am on a shared server. And they said it could be resolved by simply adding new indexes to the database or optimizing the database using […]

Retrieve and display data from custom db table in admin area?

So, i’m having a bit of an issue with a plugin i’m developing, I wonder if anyone can shed any light on the situation, as many, MANY searches have come back with zero help. :-/ Basically, my plugin creates several custom entities in the wordpress database, which all work fine, I have added a shortcode […]

Custom form that store input in database

I have never used WordPress before, but have done a lot of programming. But what is the normal way of making customs forms? I need to create a form where a user fill some input fields and on submit will the data be stored in the database. No need for any email. I also need […]

Creating table with plugin is not working

After reading many question and answers and many had asked the same question I have been following the same instruction as the people instructed but my bad it’s not working I have used dbDelta($sql) $wpdb->query($sql) It’s not working sample code <?php /* Plugin Name: ContactUs Plugin URI: Description: Simple Plugin Developed for Testing purpose Version: […]