How to programmatically create a connection with [Plugin: Posts 2 Posts] on cpt publish?
Just call p2p_connect( $id_of_post_type_a, $id_of_post_type_b ); in the form handling code.
Just call p2p_connect( $id_of_post_type_a, $id_of_post_type_b ); in the form handling code.
Solved it! Used save_post to run push_notification() as well as to run the function save_post_meta() that saves my post meta. The problem occurred coz push_notification() gets fired before save_post_meta() due to which the meta wasn’t being saved and therefore it remained inaccessible. Just changed priorities of the functions to make it work like so : … Read more
This is probably not the best way to do it since it wont persist after wordpress updates (but hopefully the update will correct it. In wp-admin/includes/post.php ,edit the post_preview() function just before returning the apply_filters( ‘preview_post_link’, $url ); put the following code: //ORIGINAL //$url = add_query_arg( $query_args, get_permalink( $post->ID, true ) ); //CHANGES to make … Read more
You can use my plugin Posts Creation Limits which has a per user, per role, per post type, per post status limiting system and combined with its post_creation_limits_custom_checks action hook and check if the user has created a post that day already – if so: show the the “limit reached message”. For example: add_action( ‘post_creation_limits_custom_checks’, … Read more
There’s not a good way to do this as the code for this section is pretty rigid. You can simply remove the elements via JavaScript. By removing (and not just hiding) the elements, you disable the functionality. You can customize the following to your needs I’m sure. Use CSS to hide the post actions inner … Read more
I’m using a plugin called Advanced Access Manager to enable certain permissions to different userlevels/groups, this should be able to do exactly what you are asking.
You can hook into the post footer actions (based on this answer, not tested): add_action( ‘admin_footer-post-new.php’, ‘wpse_80215_script’ ); add_action( ‘admin_footer-post.php’, ‘wpse_80215_script’ ); function wpse_80215_script() { if ( ‘post’ !== $GLOBALS[‘post_type’] ) return; ?> <script> document.getElementById(“publish”).onclick = function() { if ( confirm( “Ready?” ) ) return true; return false; }</script> <?php } These actions are called … Read more
Without doing Ajax (like in Quick Edit), the admin_url should be the very edit.php page. Note that: the filter post_row_actions takes two arguments, the second one being $post, so the global is not necessary. instead of using id as query argument, it’s best practice to use custom names, in this case update_id. I didn’t know … Read more
First create a function that will print the publish button : //function to print publish button function show_publish_button(){ Global $post; //only print fi admin if (current_user_can(‘manage_options’)){ echo ‘<form name=”front_end_publish” method=”POST” action=””> <input type=”hidden” name=”pid” id=”pid” value=”‘.$post->ID.'”> <input type=”hidden” name=”FE_PUBLISH” id=”FE_PUBLISH” value=”FE_PUBLISH”> <input type=”submit” name=”submit” id=”submit” value=”Publish”> </form>’; } } Next create a function to change … Read more
The {$old_status}_to_{$new_status} and {$new_status}_{$post->post_type} hooks tend to generally solve the problem. To avoid running the code in case post status is changed to draft then published again (after already being published), implement a simple flag using the post_meta functionality. Note: the updated hook should be ‘draft_to_publish’ instead of ‘draft_to_published’ however, the code below is not … Read more