Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch from custom edit page, to meta boxes on an Add New page #66

Open
GaryJones opened this issue May 27, 2019 · 0 comments
Open

Switch from custom edit page, to meta boxes on an Add New page #66

GaryJones opened this issue May 27, 2019 · 0 comments
Assignees

Comments

@GaryJones
Copy link
Contributor

GaryJones commented May 27, 2019

Currently, the add new redirect page is found at edit.php?post_type=vip-legacy-redirect&page=add-redirect.

This is created by registering a new admin page, via add_submenu_page().

However, since the purpose of the screen is just to add a new instance of a custom post type (something that WP already supports), we can go about this in a different way.

What we need is to allow the creation of new posts (vip-legacy-redirect), and then register a callback that amends the metaboxes on the page, to add a custom metabox that includes the fields we need.

Among other benefits, would be that the Publish metabox would be visible - this allows the later supporting of scheduled publishing of redirects to make them live, and different redirect statuses. Until this we could likely remove these from the Publish metabox.

  • remove the 'create_posts' => 'do_not_allow' capability. This will turn on the Add New button at the top of the Redirects list page (see "Add Redirect" button in All Redirects page #39), and add a new "Add New" page at post-new.php?post_type=vip-legacy-redirect.
  • add in methods to register metabox, and provide fields in custom metabox.
  • remove existing registration of pages and generated HTML methods.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant