I would like to not only pre-populate the title, tags, and categories, but would also like to pre-populate the slug / permalink as well.

Can I do this and if so how?

Here's my functions.php code:

add_action( 'load-post-new.php', 'myplugin_post_new' );
function myplugin_post_new(){
    add_action( 'wp_insert_post', 'myplugin_wp_insert_post_default' );
function myplugin_wp_insert_post_default( $post_id ){
    wp_set_post_tags( $post_id, $_REQUEST['tags']);
    wp_set_post_categories( $post_id, $_REQUEST['cat']);

If I go to .../post-new.php?post_title=testing&content=testing2&tags=2014&cat=1, I get my title, content, tag, and category pre-populated. Only missing the slug/permalink.

Currently, I'm not wanting to use the XML-RPC method...

What I would like to do:

I would like to generate a page dynamically from a user's response in a form. The user would then be presented an editor where they can make final edits before publishing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.