How to export posts with featured image

There’s not an easy way to modify the export query that runs under /wp-admin/export.php. It doesn’t use the WP_Query or the get_posts() wrapper, instead it currently uses this query: $post_ids = $wpdb->get_col( “SELECT ID FROM {$wpdb->posts} $join WHERE $where” ); without explicit filters to it, though it’s possible to filter few settings through the export_args … Read more

Convert custom fields to post categories

It’s a good question. There is many ways to apply a little script but the simplest way to do this take a few lines. A note about the following code: Most parameters might be added to the query like meta_query, category. wp_create_category(), will create a category once. wp_set_post_terms(), only work with native post types, will … Read more

List latest posts in WP-Admin

All you need is a table with class=”widefat” and get_posts(). Then you run through the results (if there are any) and print the table rows. Here is a very simple example as a dashboard widget. Note the lack of I18n – it is not ready to use! <?php /** * Plugin Name: Last posts table … Read more

How do you display posts in a dynamic table?

If you want do what the TablePress author recommended, you’d need first to create a custom page (or post category) template – see Codex for Page_Templates – I wouldn’t explained it better then there. 🙂 There you’d need to create a custom WP_Query, or get_posts() / get_pages() query to get the list of posts or … Read more

How to add metabox for post of specific category

Instead of if ($post_id->post_category[0] == 18) try if ( $post_id && in_category( 18, $post_id ) ) Also the ‘save_post’ action should be add_action(‘save_post’,’my_meta_save’, 10, 2); If you want the metabox to appear on a new post when the category is selected, then remove the outer category test if statement so that the metabox is always … Read more

disable password protected page for logged users

Disable the post password protection for (some) users You can try the post_password_required filter (4.7+) to override it for logged in users: add_filter( ‘post_password_required’, function( $returned, $post ) { // Override it for logged in users: if( $returned && is_user_logged_in() ) $returned = false; return $returned; }, 10, 2 ); or disable it for users … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)