I’m trying to modify WordPress “press this” http://codex.wordpress.org/Press_This to post with the post type that my theme created.
By default Post this open the link http://www.xxxx.com/wp-admin/post-new.php
And I want it to open http://www.xxxx.com/wp-admin/post-new.php?post_type=recipe
Have tried the following code in Functions.php but nothing happens
function press_this_ptype($link) {
$post_type = 'recipe';
$link = str_replace('post-new.php', "post-new.php?post_type=$post_type", $link);
return $link;
}
add_filter('shortcut_link', 'press_this_ptype', 11);
Studying the file, I think the best entry point is the function
wp_update_post()
that has a filter we can use:After that, we’ll notice the need to hide some stuff from the Press This screen (post formats, categories, tags):