Retrieving and Displaying Data From a Table

You have this: <li><?php echo $retrieved_data->column_name;?></li> <li><?php echo $retrieved_data->another_column_name;?></li> <li><?php echo $retrieved_data->as_many_columns_as_you_have;?></li> Here, the code tries to output the data in the column_name column, but there is no column in the table by that name. Likewise, there is no another_column_name or as_many_columns_as_you_have columns in your table. We know that the query pulls in the data, … Read more

Accessing two databases

You can easily set up another $wpdb object to access your other database. $mydb = new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST); var_dump($mydb); That, of course, uses the default connection credentials but if you defined different constants and used those, is should work just fine. If this other database is not a WordPress database, you won’t have … Read more

Multiple WP install with same users database

You can do the sharing of users fairly easily. Basically, both sites would use the same database (set up in wp-config.php), but each would get it’s own, unique $table_prefix. From there, you can specify custom user and user meta tables that are the same for each site. <?php // site 1 wp-config.php $table_prefix = ‘site1_’; … Read more

Showing content from another wordpress installation database in the page template loop?

On your edit2: If it’s exactly the same, could you add echo apply_filters(‘the_content’, {$mypost->post_content}); to apply the_content filter to parse the shortcodes? Also, why not use the multi-site feature of WordPress? If so much is identical, it seems more straightforward to update if your code is not duplicated. And for shared content you could then … Read more

How to delete custom field “suggestions” from dropdown list

You can filter the query for these keys on’query’. I would start that filter as late as possible to avoid side effect. Sample code, tested: add_filter( ‘postmeta_form_limit’, ‘wpse_73543_hide_meta_start’ ); function wpse_73543_hide_meta_start( $num ) { add_filter( ‘query’, ‘wpse_73543_hide_meta_filter’ ); return $num; } function wpse_73543_hide_meta_filter( $query ) { // Protect further queries. remove_filter( current_filter(), __FUNCTION__ ); $forbidden … Read more