Tag Info

New answers tagged

0

There're some special tables Codex Link in Multisite. In short: No you can't. But you can degrade to a single site install and then import them there. If in doubt, simply add a new local multisite install, import the posts there, downgrade to single site and then export/import again.


0

I think you are jumping a gun with custom SQL, complexity of this seems still in realm of WP_Query. Even if not it's a good idea to start with it to have more solid base for custom SQL. If I try something like this: $meta_query = array( array( 'key' => 'body_type', 'value' => 'bt' ), array( 'key' => 'Make', 'value' => 'make' ), ...


1

Worst case scenario, just make a new environment, with that theme (can even be on the live), then just re-upload the CSS and anything else you've edited (successfully that is).


2

Please use $wpdb to interact with the Database. global $wpdb; $wpdb->update( // Table name $wpdb->posts, // New values array( 'post_type' => 'product', ), // SQL "WHERE" clause base / affected rows array( 'post_type' => 'post', ), // Data Type (available: %s string, %d integer, %f float) '%s', // SQL "WHERE" ...


0

Unfortunately, it seems that you have now learned the hard way that you should not: trust only your web hosting company to keep your data intact, or keep your backups on your web server. Sadly, restoring your WordPress installation -- if at all possible -- will most likely not be easy! You might be able to retrieve the image files that were stored in ...


1

This constant is actually never defined in core code at all. You can define it yourself in wp-config.php configuration if you need to, but core doesn't need it defined for normal operation. It only exists for re–configuring into running untypical setup.


0

You can just call get_user_meta without specifying a key, and it will return all MetaValues for the user. $userdata = get_user_meta( $userID ); You may have to do a mapping for displaytitles of the Metavalue, as they are returned in an array, where the keys are the databasevalues of your metakeys. For example, you may get ...


0

It's even easier than what you did. . Copy the entire wp structure from the old server to the new, mysql backup the database with creates enabled and import to the new database (preferably blank) . Then just edit the wp configuration file for the new locations of everything (including database name) . I have done this hundreds of times... Never fails. . ...


1

Per comments, you basically have it - just GROUP BY $wpdb->term_relationships.object_id instead; also to be pernickety, you'd use standard (INNER) JOINs rather than LEFT ones: SELECT $wpdb->term_relationships.object_id FROM $wpdb->term_relationships JOIN $wpdb->term_taxonomy ON $wpdb->term_taxonomy.term_taxonomy_id = ...


0

I would do it in php in two parts rather than one big raw sql statement, for safety reasons, eg in your "functions.php" put: function wpse160706() { $old_post_type = 'films'; $new_post_type = 'post'; $category_slug = 'directors'; $taxonomy = 'category'; global $wpdb; $sql = $wpdb->prepare( 'SELECT p.ID FROM ' . $wpdb->posts . ...


0

I am using a solution that mixes a meta field and a data as order parameters. $query = new WP_Query( array( 'post_type' => 'post', 'meta_key' => '[your vote field]', 'orderby' => 'date meta_value_num', 'order' => 'DESC', 'meta_query' => array( ...


4

This is what I've found. I'm using a filter to filter the ORDER BY on the SQL query generated by WP_Query. The filter is this posts_orderby. And with it, you can write a custom ORDER BY for the query. I'm gonna show you an example. add_filter('posts_orderby', 'posts_orderby'); function posts_orderby($orderby_for_query) { $orderby_for_query = ...


0

Yes, all the WordPress Multisite users go into the {$wpdb->prefix}users table; that way they form a pool of users that can each be given access to one or more sites in your network. You can get the users for a given site by using get_users(), which can take as an argument the ID of a given site: // get users for site example.com/my-site $args = array( ...


0

Since your questions are quite vast and not completely WordPress related, I will stick to your main question. The answer is: Yes. As long as you have it in different directories and don't use the same prefix for their database tables or have a separate database for each (which means you can stuff more than one WP installation into one database with ease) ...


1

Don't change the Post ID. Wordpress uses serialized data, and id's have deep linking within the database.


0

In your particular case, the query cache being enabled worked for your dataset. You may be wondering why MySQL 5.6 starts with InnoDB and the query cache off. Two months ago, I wrote a post in the DBA StackExchange entitled "Why query_cache_type is disabled by default start from MySQL 5.6?". I explained that InnoDB micromanages its changes within its ...


0

This is an old problem I had forgotten about. The problem here is that an old database was selected in the left hand menu of phpMyAdmin(read: I'm new to database management). The table was already in use and therefore populated - this error message is because phpMyAdmin tried to write to the first line, couldn't(already held data) and then quit. Simply ...


0

The code that you included will work provided that $wpdb has been declared and properties is a table in your WordPress database. I advise testing your query separately with wp-cli or Debug Bar Console For example, I ran the code below in the Debug Bar Console $result = $wpdb->get_results( "SELECT * FROM properties" ) or die( mysql_error() ); print_r( ...


0

$current_time = current_time('mysql'); $querystr = " SELECT * FROM {$wpdb->prefix}usermeta WHERE meta_key='bday_unix' AND DATE_ADD( from_unixtime(meta_value), INTERVAL YEAR( '{$current_time}' ) - YEAR( from_unixtime( meta_value ) ) YEAR ) BETWEEN '{$current_time}' AND DATE_ADD( '{$current_time}', INTERVAL 30 DAY )"; Should work, I think.


0

Have you tried placing the query result to a variable? $resultArray = $wpdb->get_results("SELECT * FROM properties")



Top 50 recent answers are included