Skip to content
Advertisement

How to Go to New WordPress Post After Programmatically Creating It?

I created a PHP function that will automatically create a new WordPress post based on content added onto a page. However, it just stays on the current page but I want it to go to that new created post. How could I redirect so that it goes to that post? Here’s what I have so far:

JavaScript

Advertisement

Answer

You can use get_permalink to get post url. check below code.

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement