How do I manage my users post before publish?
What role are you assigning to those users? According to Roles and Capabilities documentation in Codex it should be Contributor for users that are allowed to write posts, but not publish them.
What role are you assigning to those users? According to Roles and Capabilities documentation in Codex it should be Contributor for users that are allowed to write posts, but not publish them.
But you shouldn’t use $_POST inside that hook. transition_post_status fires when a post is transitioned from one status to another. It can be caused by anything (not only by sending POST request from editor). For example here’s the function that is responsible for publishing future posts: check_and_publish_future_post. It’s called only by cron, without sending any … Read more
Why don’t you wrap it in post save_post and post_publish hooks? You have examples here: http://codex.wordpress.org/Function_Reference/add_action How to do it: Add this to your functions.php file: function my_data_update () { $company = get_field(‘company_name’); $address = get_field(‘address’); $city = get_field(‘city’); $post_code = get_field(‘post_code’); //etc etc… } add_action(‘publish_post’, ‘my_data_update’); add_action(‘save_post’, ‘my_data_update’);
As an alternative to @m0r7if3r’s solution, the add_meta_boxes hook optionally passes two variables, the post type and post object. You can use this to conditionally add your metabox. New posts have the post status of ‘auto-draft’. add_action( ‘add_meta_boxes’, ‘myplugin_add_custom_box’,10,2); function myplugin_add_custom_box($post_type, $post) { if($post->post_status != ‘auto-draft’){ add_meta_box( ‘myplugin_sectionid’, __( ‘My Post Section Title’, ‘myplugin_textdomain’ ), … Read more
The default for map_meta_cap is actually not false if you’re also passing in a capability_type of post or page, which you are. The following code is in WordPress Core’s post.php: // Back compat with quirky handling in version 3.0. #14122 if ( empty( $args->capabilities ) && null === $args->map_meta_cap && in_array( $args->capability_type, array( ‘post’, ‘page’ … Read more
Put below code into your theme functions.php and try function change_publish_button( $translation, $text ) { if ( $text == ‘Publish…’ ) // Your button text $text=”Save”; return $text; } add_filter( ‘gettext’, ‘change_publish_button’, 10, 2 ); This one is worked for me Hope it will help you!
Dig in Core All admin UI pages use a core function for a reason: submit_button( $text = NULL, $type=”primary”, $name=”submit”, $wrap = true, $other_attributes = NULL ); There’s also get_submit_button() in case you want to return instead of print the button.
redirect deleted / drafted pages
Copy post to separate database with “add_action(….)”
Controlled publishing in WordPress