Server database problem

I believe Rarst is right. It sounds like you need to configure the wp-config.php file for the new database. Just go to the cpanel or other control panel of your hosting service, and use the address they use for the host address. If the database is on the same server as the web site, localhost …

Read more

How to STOP wordpress trying to update database?

There is a DO_NOT_UPGRADE_GLOBAL_TABLES constant that going by documentation protects tables that are global in multisites (since they can grow large because of that), but I don’t see a clean way to prevent upgrade altogether. I’d work on getting that core clean of hacks instead.

Why WordPress does not Use Separate Table for Post Types (When Registring)?

It would be a challenge to hunt down a specific moment in time when that particular decision had been made. My educated guess would be that storing CPT definitions persistently would complicate how they interact with rest of APIs (especially Rewrite and localization). WP is also relatively conservative with database structure. CPT are relatively young …

Read more

Restrict users viewing post using age on database [closed]

There are probably a few ways to do this. The easiest way I can think of is to install Pods Framework. You can install it through the WordPress repository like you’d normally install a plugin, or through GitHub. Using Pods, you can extend the WordPress user database to add a birthday field. You can also …

Read more

Problem with form database connectivity

You’re inserting raw POST data straight into an SQL query – sanitize, sanitize, sanitize! The code below should get you started, but I would advise you add some additional checks (is the email valid? are the strings too long? etc.): <?php $errors = $values = array(); if ( isset( $_POST[‘Submit’] ) ) { $fields = …

Read more

get_option returning a different value from what’s saved

In the plugin_options_validate() function the return value of get_option( ‘plugin_options’ ) is never used. Let’s step through the function by adding some comments: // Retrieve the options. $options = get_option(‘plugin_options’); // Replace the options without checking if // trim( $input[‘text_string’] ) and trim( $input[‘text_string_name’] ) // actually return strings and if $input[‘text_string’] and // $input[‘text_string_name’] …

Read more

Fetch all categories from database

get_categories function will return an array of objects, each object a category. You can read more about it here: https://developer.wordpress.org/reference/functions/get_categories/ Edit And example, as Tim Malone mentioned in the comment there are examples on that page. But here is a simple one for you, that will display your categories in a list. $categories = get_categories(); …

Read more

How to make category for word post_content

I personally find it easier to use built-in WP functions rather than running straight MySQL queries, so here’s one option: <?php global $wpdb; // replace ‘yoursearchword’ with whatever you’re looking for. // the two % symbols are to find the word no matter what comes before or after. $query = “SELECT * FROM wp_posts WHERE …

Read more