Won’t create Portfolio
-
CPT UI won’t create the cpt of ‘portfolio,’ but it will create pretty much anything else. Is ‘portfolio’ reserved in some way and can’t be used?
-
Not reserved in any way I know if, and I haven’t forced it to be reserved. In what way is it failing to register for you?
I enter, portfolio, Portfolios, Portfolio, just the basics, nothing else and it does absolutely nothing. I enter dog, Dogs, Dog or any other word like portfolio_work, Portfolio Works, Portfolio Work and everything works as expected.
does absolutely nothing in what way though? No admin UI? No Menu options? Are you also registering the same post type elsewhere, in cases where you’re maybe migrating it to CPTUI? I know “portfolio” is a very common post type so we’re definitely not going to try and hinder someone using it.
I hear ya’.
I am not registering the same post type elsewhere.
It comes down to the slug of the CPT. It won’t accept /portfolio if I try to create a CPT with that slug as a new CPT. In other words it won’t do anything, meaning if I look in the registered post types there is nothing there. However, if I create a slug of ‘dog’ and use portfolio for plural and singular it will create the CPT… AND if I THEN update the post type slug from ‘dog’ to ‘portfolio’ it will then take portfolio but when I navigate to a test post it gives me a 404.I have a page called /portfolio where I intend to show my portfolio work. Would having a page of /portfolio conflict with creating a CPT of portfolio? Is this why I can’t create ‘portfolio’ as a CPT?
Well, regardless, I’ve changed that page to be /work-portfolio and updated the CPT slug to be /portfolio (from /portfolio_work) and when I go to a test post of mydomain.com/portfolio/test-work it gives a 404. If I use anything else other than /portfolio for the CPT slug the test post will show.
I don’t know why I can’t have a slug of /portfolio.
I’ve tried looking in my db in PHPMyAdmin and that’s where I got the clue of maybe the page of /portfolio needs to be a different slug.
Doing some further inspection…
The archive
https://mydomain.com/?post_type=portfolio
will show both test cpt posts, but when I click on either singular post titles of /test-work or /test-work-2 I get the 404 error.Also I can confirm by looking in phpMyAdmin in the post_type column that there is only one ‘portfolio’ post type, the one I created by creating post type ‘dog’ first, and then changing it to ‘portfolio.’ I do this because CPT UI won’t allow me to create post_type ‘portfolio’ with zero registered post_types.
-
This reply was modified 5 years, 11 months ago by
benjammin.
Some thoughts.
If you’re able to save a post type in your CPTUI settings with a slug of “portfolio”, and you’re also able to create posts in this new post type, via the admin menu on the left, then it’s registered and you can create content for the post type.
For sake of example, you title a post in that post type “My Item”, and it receives a post name slug of “my-item”.
If you have a PAGE named “portfolio” still on top of the post type slug of “portfolio” and visit
.com/portfolio/my-item
and it shows you a 404 error, chances are WordPress is thinking “my-item” is a child PAGE of the “portfolio” page, and not a custom post type post. Until told otherwise, this is my hunch of where it was assumed things weren’t working and a “portfolio” post type wasn’t allowed.“Would having a page of /portfolio conflict with creating a CPT of portfolio?”
Yes it would.
In regards to possible created posts when you had the portfolio slug be “portfolio_work”, simply juggling the post type slug vs page slug won’t be enough to see content at the url.
.com/portfolio/test-work
and the “test-work” part would still have the “portfolio_work” post type associated with it in thewp_posts
table. You would need to change “test-work” post and get that post type value to show up when visiting.com/portfolio/test-work
because at that point, it’s assuming it’s a “portfolio” post type post.So, at this point, to confirm that there is nothing holding a “portfolio” post type, I’d do/confirm the following steps.
1. Remove or at least rename the “portfolio” PAGE.
2. Get/confirm that you have a post type slug named “portfolio” in CPTUI’s settings.
3. Use the admin UI to create a new post in that post type.
4. Click to view the frontend and specifically this new post.
5. Confirm that it’s showing its contents like expected.
6. Click to visit.com/portfolio
, assuming that you have archives set to true, and it should show 1 post there, which would be this newest post.
7. If needed, visit the permalinks settings page in the admin, to refresh the permalink rules. If you got to this point, recheck steps 4-6.
8. Report findings of success or ongoing lack of resolution back here.I have a good feeling that this will be resolved though. The detail about the page slug matching the post type was the key in my mind, and throws people off fairly regularly.
1. I did and it still won’t show /portfolio/test-post when I update the cpt slug by checking the update posts and clicking save.
2. #2 should be #1 as you’re reading this, so yes, I can confirm I have a post_type of ‘portfolio’ in CPTUI’s registered post types, and in my phpMyAdmin db.
3. With all settings to a cpt of ‘portfolio,’ confirmed in the registered post types of cptui plugin, and in phpmyadmin db, I created a new post in portfolio and I’m still getting a 404.
4. yes I did this.
5. not showing its contents, shows 404.
6. has archive is set to true, and single-post view will still show 404.
7. I’ve been refreshing permalink rules as step every time.
8. single-post view is still throwing a 404; though I do get an archive showing for /portfolio, AND /portfolio page has been changed to /work-portfolio.I found the problem. I had the taxonomy of media_type (logos, print design, web design) with a rewrite slug of ‘portfolio.’ I removed the rewrite and now I can see a single post.
However, going back to the very beginning before I even created a taxonomy for cpt ‘portfolio’ I had the page of ‘portfolio’ and so at first that is why it wouldn’t allow me to create a cpt of the same, and then… ah well you can see how it all got confusing. I can honestly say I am learning more about how CPT UI works in making these mistakes!
I thank you kindly for your most logical help and support!
-
This reply was modified 5 years, 11 months ago by
benjammin.
Ahhhhh, I don’t tend to think of taxonomies in this case, but very obviously also play their part in possible conflicts. My mind goes to page slugs first.
To be fair, this isn’t anything specific to CPTUI, but it is details that trickle down into WordPress core and what they determine they need to query for, based off the URL. You would encounter the same issues if you were manually registering yourself.
Regardless, it sounds like you’re back into a good position and able to move forward with your Portfolio post type.
-
This reply was modified 5 years, 11 months ago by
- The topic ‘Won’t create Portfolio’ is closed to new replies.