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

Preview custom post types and warn if not currently registered #38

Open
bobbingwide opened this issue Apr 18, 2016 · 7 comments
Open

Preview custom post types and warn if not currently registered #38

bobbingwide opened this issue Apr 18, 2016 · 7 comments

Comments

@bobbingwide
Copy link
Contributor

This was an easy mistake to make. Having decided to give the new code something to chew on, importing content from many sites into one new WPMS site, including content from an existing WPMS network, I forgot to install and activate all the required plugins. Consequently the importer failed to import posts of a particular CPT.

It would be nice if the import file could be previewed and problems like this pointed out in advance.
BTW: I would have let it import the content even though the post type wasn't registered.

@swissspidy
Copy link
Contributor

I see no harm in importing the content when the post type doesn't exist. I mean it could perhaps show a small notice, but why should it prevent you from importing the post?

@rmccue
Copy link
Member

rmccue commented May 24, 2016

@swissspidy Permissions may be bothersome. You can't know the permissions of a post type until it's registered.

@bobbingwide
Copy link
Contributor Author

I don't have any problems with permissions. What difference would it make? To whom would the unregistered posts be visible?
In my experience, the person performing the import would probably rather see the import succeed than fail.

@rmccue
Copy link
Member

rmccue commented May 25, 2016

If you import an unknown post type without an author, it will assign that to the current user. If the post type is later registered, you may not have permission to create posts in that post type, yet you will have posts that belong to you anyway.

As an example: imagine you have permission to write posts on a site, but not create WooCommerce plugins. During some maintenance, WooCommerce is disabled. You run an import containing products, which then get assigned to you. WooCommerce is re-enabled some time after the import. Despite not being able to create/edit products, you now have them :)

@ntwb
Copy link
Member

ntwb commented May 25, 2016

My scenario outline would entail a privacy case, if the post type defines exclude_from_search: true and/or publicly_queryable: false, if the plugin that registers these posts isn't activated then whatever data is contained within those posts that be published, if the site they were imported on is connected to the internet and publicly available then that data is now public.

@bobbingwide
Copy link
Contributor Author

@ntwb I tested your scenario using WordPress and my oik-types plugin.

  • I created a post type called "books" which was public but excluded from search and not publicly queryable.
  • I created some posts
  • And viewed them using ?p=id and permalinks
  • I then deactivated my plugin

I then tried to access them:

  • The posts were not accessible through the front end
  • BUT, a shortcode to display a link to one of these posts did produce a permalink - but following the link resulted in a 404.
  • other shortcodes failed to find them.

The above tests were performed when logged in as admin.

My conclusion. WordPress protects post types which are not registered. It's not something that WordPress-Importer should be worried about.

@bobbingwide
Copy link
Contributor Author

OK, can we go back to the original point. It would be nice if the UI displayed the count of each CPT and offered the user the option of importing the post type or not. If the post type was not currently registered then it would also be nice to indicate this. It then becomes the user's responsibility to decide how to proceed.

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

4 participants