How can I make it so the Add New Post page has Visibility set to Private by default?

since you’re developing a plug-in, I assume you don’t want to touch any files outside of wp-content/plugins or ../themes for that matter. However, if that’s not the case, follow along: Go to wp-admin/includes/meta-boxes.php and find: $visibility = ‘public’; $visibility_trans = __(‘Public’); Now change it to the obvious: $visibility = ‘private’; $visibility_trans = __(‘Private’); Again, this … Read more

Hide permalink and preview button and link on custom post

You can accomplish the above using hooks. Use the code below in your active theme’s functions.php file to get this work delete permalink under wordpress post title add_filter( ‘get_sample_permalink_html’, ‘wpse_125800_sample_permalink’ ); function wpse_125800_sample_permalink( $return ) { $return = ”; return $return; } Customizing post link from original wordpress add_filter( ‘page_row_actions’, ‘wpse_125800_row_actions’, 10, 2 ); add_filter( … Read more

add action only on post publish – not update

Like @milo pointed out in the comment, checking if the post meta exists is the easiest way to achieve what you want – like this: add_action(‘publish_post’, ‘wpse120996_add_custom_field_automatically’); function wpse120996_add_custom_field_automatically($post_id) { global $wpdb; $votes_count = get_post_meta($post_id, ‘votes_count’, true); if( empty( $votes_count ) && ! wp_is_post_revision( $post_id ) ) { update_post_meta($post_id, ‘votes_count’, ‘0’); } } → On … Read more

How to HIDE everything in PUBLISH metabox except Move to Trash & PUBLISH button

You can simply hide the options using CSS. This will add a display:none style to the misc and minor publishing actions on the post.php and post-new.php pages. It checks for a specific post type as well since all post types use these two files. function hide_publishing_actions(){ $my_post_type=”POST_TYPE”; global $post; if($post->post_type == $my_post_type){ echo ‘ <style … Read more