I do not want my clients to select a parent page from the drop down list, when creating a child page, so I would like to create a link on the dashboard which links to “add new page” – but with a preselected parent page.
Is this possible? And if not, then is there a way to change the default parent from “(no parent)” to a parent of my choice?
welcome to WPSE!
This answer from Mike Schinkel was useful to find a
solution* for Get QueryString values with jQuery.*
(not used anymore, a simple$_GET
does it)It’s also worth noting that, in that same answer, Mike also links to this other important Question: What is the best way to add custom javascript files to the site?
That being said, the following code does the trick. It doesn’t use
admin_enqueue_scripts
-best practice-, and instead is printing it directly in the admin footer…Add this code to your theme’s
functions.php
and make your custom link to “Add New Page” like this:http://example.com/wp-admin/post-new.php?post_type=page&the_id=28
, beingthe_id
the ID of the desired parent page.