Tag Info

Hot answers tagged

4

First of all, the prefix is only a configuration option and not a security feature. The reason is that once an attacker has access to your database, he can find out any exisiting table prefix within seconds. There's no way this obscurity protects you from any attack. For the prefix itself, WordPress asks you to use only digits, letters (here only basic ...


2

Try this, should get you started.. (not tested though) function count_total_vote() { $args = array( 'post_type' => 'post', // Your post type 'status' => 'publish', 'meta_key' => 'vote', // Meta Key ); $total = 0; $votes = new WP_Query( $args ); if ( $votes->have_posts() ) { while ( ...


1

There may not be a need for a custom query, but I'd recommend it rather than hitting the database: - once for the WP_Query - once more for each post entry And then manually working out the math in PHP. Do it all at once with one MySQL statement. select sum(PM.meta_value) from wp_postmeta PM join wp_posts P on P.ID = PM.post_id where P.post_type='page' ...


1

It depends on what version of WordPress your sites run. If you are up to date, you shouldn't have much of an issue. According to the official WordPress hosting guide, any version of MySQL version 5.0.15 or greater is supported for WordPress. You can give this article a read and see if there is anything that jumps out at you as being particularly ...


1

Quite a few options you have here but the simplest I suppose would be to change your SQL query like so: SELECT 0 AS id, user_login AS name, display_name AS tag, user_status AS status FROM wp_users; You can see that now we have the needed order and when you will do the $row['id'] = $i; assignment we will use that position instead of creating a ...


1

Fatal error: Cannot redeclare append() is very simple to fix: Your plugin seems to have a function called append(), right? On the wordpress install with this error there is another plugin which has a function append() too. You can fix this using PHP Namespaces or just give your function a more unique name like pluginname_append().


1

This is pretty straightforward. You can use phpMyAdmin or MySQL Workbench to change the prefix on all the tables at once, or you can do it one-at-a-time with a tool like SequelPro. If you need to run the SQL by hand, the syntax is… RENAME TABLE `old_name` TO `new_name`; Once all the table names are updated, you simply update the $table_prefix value in ...


1

Alleluia... After multiple trials (like converting my tables to utf8_unicode_ci -- didnt work), here's the only successful fix I found : define('DB_CHARSET', 'utf8'); In wp-config.php, replace utf8mb4 by utf8.



Only top voted, non community-wiki answers of a minimum length are eligible