Query All users that has post

add this in your arguments ‘query_id’ => ‘authors_with_posts’, $user_args = array( ‘role’ => ‘frontend_vendor’, ‘orderby’ => ‘display_name’, ‘query_id’ => ‘authors_with_posts’, ‘order’ => ‘ASC’, ‘number’ => $no, ‘offset’ => $offset );

Code Blocks with WYSIWYG in blog post

There are several ways to deal with this problem. You could have a look for some syntax highlighter plugin, those will also bring you coloured text with highlighted keywords etc. pp. This is probably nice, if you use code quite often. I use SyntaxHighlighter Evolved. If you want to do this by hand, <code> is … Read more

Content editor creating blank paragraphs in spaces and creating &nbsp in the_excerpt

Judging from your site’s content and the comments, you may try using the following CODE in your theme’s functions.php file. It’ll remove empty <p>&nbsp;</p> tags from post content: add_filter( ‘the_content’, ‘wpse_257854_remove_empty_p’, PHP_INT_MAX ); add_filter( ‘the_excerpt’, ‘wpse_257854_remove_empty_p’, PHP_INT_MAX ); function wpse_257854_remove_empty_p( $content ) { return str_ireplace( ‘<p>&nbsp;</p>’, ”, $content ); } However, after it removes the … Read more

Pagination not working on custom query

The pagination functions work off of the main query, so you’d need to use pre_get_posts instead of creating a new query for them to work. But, you’re using WP_User_Query, so the standard pagination system will never work for you. You’re going to have to ‘roll your own’ pagination system here, and generate your own URLs … Read more

Future_to_publish into postmeta

Use publish_future_post action hook. Contrary to what Codex says, it is not deprecated, and it works with WordPress 4.8.2. Your code should be: function my_test_future_post( $post_id ) { update_post_meta( $post_id, ‘hook_fired’, ‘true’ ); } add_action( ‘publish_future_post’, ‘my_test_future_post’ ); Tested! Update If you are concerned about publish_future_post hook being deprecated, use transition_post_status hook: function my_test_future_post( $new, … Read more

Remove image from post also removes photo from media library

Don’t know if there is an easy way out but you can do this to achieve: Introduce an admin js in your functions.php like this: //Admin JS add_action(‘admin_init’, ‘custom_admin_js’); function custom_admin_js() { wp_register_script( ‘admin-js’, get_stylesheet_directory_uri() . ‘/js/admin.js’ ); wp_enqueue_script( ‘admin-js’ ); } The js file will go in the theme you are using make another … Read more

Undefined variable post_id in custom quick edit coloumn

Sorry, I’ve had to change my answer after checking the WordPress Codex on adding custom editable data to the quick edit. So you’ll have to remove the references to $post_id too (from the add_action arguments and from within your function). It looks like the quick_edit_custom_box only takes 2 arguments: $column_name and $post_type. Then for getting … Read more