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

Feature Request: Add ability to duplicate CPTs & TAXs #760

Open
garretthyder opened this issue Sep 10, 2019 · 9 comments
Open

Feature Request: Add ability to duplicate CPTs & TAXs #760

garretthyder opened this issue Sep 10, 2019 · 9 comments

Comments

@garretthyder
Copy link
Contributor

Hello,

I was going to create a second taxonomy for a CPT that was identical to another aside from it's name...

It would be really nice to have a Duplicate feature in CPTUI so you can create a new CPT or TAX from a pre-existing one to speed of your development flow.

I hope that makes sense,
Cheers

@tw2113
Copy link
Member

tw2113 commented Sep 11, 2019

I believe renaming the slug without doing a content migration works for this. Not so much an advertised feature, but more a happenstance one. Happens because the part we do any checks/comparisons against gets edited so it assumes it's a brand new one and happily saves.

@Brugman
Copy link

Brugman commented Oct 1, 2019

I just accidentally did this. Yes, not checking migrate will dupe it to a new name.

@garretthyder
Copy link
Contributor Author

Thanks @tw2113 and @Brugman for confirming. I wonder if we add a note there to indicate to users how that works as a method to copy?

@tw2113
Copy link
Member

tw2113 commented Oct 2, 2019

We kind of do with one of the Help questions.
Screen Shot 2019-10-01 at 7 26 56 PM

Not really an often asked question, so I just take them as they happen to come in.

garretthyder pushed a commit to garretthyder/custom-post-type-ui that referenced this issue Oct 2, 2019
garretthyder pushed a commit to garretthyder/custom-post-type-ui that referenced this issue Oct 2, 2019
@garretthyder
Copy link
Contributor Author

Thansk Michael, I think it would be useful to expose this as a feature on the checkbox so users have the information available. Adding PR

@tw2113
Copy link
Member

tw2113 commented Jan 7, 2020

Hey @garretthyder still open to accepting in a PR for this. Ready whenever you are.

@maxjf1
Copy link

maxjf1 commented Mar 18, 2020

I will try to create an PR for this.

I'll try to do something like the current Populate additional labels based on chosen labels Button, with JS. Maybe an select that you choose the tax/cpt you want to dup, then download with AJAX the fields for it and fill the form with them. What do you think?

@tw2113
Copy link
Member

tw2113 commented Mar 19, 2020

I'm open to see what you come up with, and let you explore potential ideas. :)

I do know I've generally shied away from adding AJAX based functionality to CPTUI, but that's also in large part because I had not yet had a reason to make use of AJAX yet either.

That said, as I sit here and think about it, if I were taking this on myself at the moment, I'd probably add a checkbox below the "migrate posts" and "migrate terms" checkboxes. Then, if checked, also show a new text field for the new slug to use. That way, one could simply hit save, let things refresh, and if we have the checkbox and new slug, pass those along to the save/update functions. Very likely a case of grabbing the currently edited content type slug, and the matching saved from our options setting, based on that slug, replace the index name with the chosen replacement, and then re-updating the option. I hope that makes some sense.

Things to keep in mind here

  1. We'll want to make sure we're making use of available nonces and admin referrer fields.
  2. Making sure we're grabbing and passing along all the right info to the right places.
  3. Plenty of testing.

Stuff to consider, and it's not a method/way that you MUST do things.

@tw2113 tw2113 added this to the future release milestone May 17, 2022
@tw2113
Copy link
Member

tw2113 commented Aug 2, 2022

@garretthyder Curious on some thoughts from you.

Where would the UI for this be at, ideally from user experience POV? when editing a given post type/taxonomy? or perhaps in our little table area in /wp-admin/admin.php?page=cptui_listings and that first column?

Also would it be a case of just refresh the page with the newly duplicated item listed with the rest? or would it take you directly to editing the newly created type/tax? Perhaps with the slug value empty and to be filled in?

I'm kind of leaning towards the duplicate link being in the listing, and the user redirected to edit that newly created item and no slug filled in by default, but the rest would be.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants