Articles of database

Bootstrapping WordPress MultiSite Outsite of WordPress – No $wpdb

I’m working on a plugin for a system to use WordPress as the authentication backend, so that I can use my existing WordPress users in another application. The plugin works great when running in single website mode: include /path/to/wordpress/wp-config.php global $wpdb; // SQL and code to select user and compare entered passwords I need this […]

How to find if a post with custom_field == X exists?

I need to find if a post with a custom field X equal to Y exists in a wordpress installation. Should I do it with a simple sql query or is there something build in that can help me achieve it?

Using two different DB users on one WP install

I’m curious as to whether the following is possible as there are concerns that the WP site in question may be hacked via the front end & through a plugin.. We want to have the front-end connect via a Read-Only DB user We want the admin area to have Read/Write access but have this URL […]

How to generate page content from database the right way?

I am creating many pages and store them into the database. I am first styling them and than storing them. The idea is to use page.php to check the page id and display the needed post. This is all good, but I have many pages in the website. WHich means I have to perform the […]

Single database for multiple instances

I would like to create two instances of WP on a single domain. For example, I would like wp1.domain.com and wp2.domain.com to use a single database (same comments/posts). One for production and one for development. Is this possible, and if so, how?

Query from a different database than the default

I’m making a layout for a wordpress page. The layout needs to connect to a second database (both databases are in the same domain). But the problem is, when i execute just the file it works. But when i included inside the wordpress layout i don’t get data, no errorrs, nothing The script is just: […]

How to write one comment and publish on every post using database or plugin?

I have about 500 posts published in WordPress now I want to add one same comment on every post. How to do the by the database. I search about it, but not a good luck. thanks in advance for the help.

Who is responsible for data sanitization in WordPress development?

I am studying how to write more secure WordPress code by implementing validation, sanitization and data escaping wherever necessary. Validation and escaping makes perfect sense, but I am a little confused about sanitization. If I use a function like add_post_meta, does this function do sanitization for me? What about set_option or other ones that interact […]

How to migrate a HTTPS WordPress installation to localhost?

I’ve migrated a site from a live server to a localhost using the WP Migrate DB plugin. I’ve done this process a couple of times before and it’s all been fine. This time however I’ve migrated a site from an https: connection and I can’t get into the site on my localhost. It gives me […]

Remove the deleted users avatar from list

Problem Hi everyone, I have a bit of a problem. I have a function that outputs the avatars of users that follow me . It works great, but if the user is deleted the avatars remain visible as a blank image box with a broken hyperlink missing the users username. Is there any way to […]