POST from jQuery to PHP

When you load your process.php file directly, it’s not within the context of the WordPress environment, so no WordPress functions are available. WordPress has a native AJAX API that should be used for this sort of thing. First, enqueue your javascript file, then use wp_localize_script to pass the location of admin-ajax.php, which will be processing … Read more

How to get new post URL?

admin_url(‘post-new.php’); The admin_url function will handle generating most of the link, you just need to give it the final component. You can pass in GET parameters as well. Just look at the backend URL to see what you need. admin_url(‘post-new.php?post_type=page’); Or using add_query_arg as suggested by @Rarst … add_query_arg(array(‘post_type’=>’page’),admin_url(‘post-new.php’)); It is overkill for simple URLs … Read more

Post author is changed to admin after his post is modified by admin

The administrative editors could fix the author manually. Alternatively, you could add custom post meta-data to designate the original author. Then, hooking into the publish_post or transition_post_status actions (or even save_post for that matter) you could check for the presence of the meta-data when a post is being published, and if it exists, replace the … Read more