I'm wondering... how can I get the new post URL in my theme? Is there a built-in function for this?

So, it should return something like http://example.com/wp-admin/post-new.php?post_type=post.



1 Answer 1


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.


Or using add_query_arg as suggested by @Rarst ...


It is overkill for simple URLs but useful for dynamic ones.

  • Thank you! This works like a charm. I'd vote you up, but I need more rep. When I get some more, I'll vote you up :) Commented Jun 29, 2013 at 14:57
  • 2
    There is also add_query_arg() for adding more complex GET argument sets to URL.
    – Rarst
    Commented Jun 29, 2013 at 15:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.