Add new post using a page inside the website

You have never read the WP documentation? Create any template and form and when submitting the form it could be Example: $args = array(‘post_type’=>’post’, ‘post_title’=>’your title’, ‘post_status’=>’publish’, ‘post_content’=>’post content’); wp_insert_post ($args); This will allow any post page or custom post type to insert the post

Get content of publish box

add_action( ‘post_submitbox_misc_actions’, ‘show_current_filter’ ); add_action( ‘post_submitbox_start’, ‘show_current_filter’ ); function show_current_filter() { $post = get_post(); print ‘<pre>’ . $post->ID . ‘ : ‘ . current_filter() . ‘</pre>’; } https://codex.wordpress.org/Plugin_API/Action_Reference/post_submitbox_misc_actions https://developer.wordpress.org/reference/hooks/post_submitbox_start/

revision id is one number behind – publish_post

See this- function check_values( $post_ID, $post ) { $revisions = wp_get_post_revisions( $post_ID ); $revision_ids = []; foreach ( $revisions as $revision ) { $revision_ids[] = $revision->ID; } // $revision_ids; // holds all revision ids // $revision_ids[0]; // latest revision // $revision_ids[1]; //revision just before the latest one } add_action( ‘publish_post’, ‘check_values’, 10, 2 );

Publish Post Action Not Working

wp_publish_post – Publish a post by transitioning the post status. Note: This function does not do anything except transition the post status. If you want to ensure post_name is set, use wp_update_post() instead. publish_{$custom_post_type} – publish_post is an action triggered whenever a post is published, or if it is edited and the status is changed … Read more

Do something with thumbnail image on post publish

Actually WordPress offer a good hook , You can get data from Post Published , for more you can follow this example : https://codex.wordpress.org/Plugin_API/Action_Reference/publish_post Example of a simple update of custom field: /* Do something with the data entered */ add_action( ‘save_post’, ‘myplugin_save_postdata’ ); /* When the post is saved, saves our custom data */ … Read more

Create a new post on a specified publish date via link?

Here is the solution I came up with! In my plugin functions: <?php function ficma_inline_script() { $datedata = explode(“-“, $_POST[‘date’]); $year = $datedata[0]; $month = $datedata[1]; $day = $datedata[2]; $newdate = date(“M d, Y”, mktime(0, 0, 0, $month, $day, $year)); ?> <script type=”text/javascript”> document.getElementById(“mm”).value = “<?=$month ?>”; document.getElementById(“cur_mm”).value = “<?=$month ?>”; document.getElementById(“hidden_mm”).value = “<?=$month ?>”; … Read more