Make your own Custom Post Type plugin with custom Taxonomy easily

This video post shows that you don’t need to a be an ace developer to build your own simple plugin. This is also part of a series I am developing on creating a Product site with Beaver Builder and Beaver Themer.

You might want to do this because:

1. It’s a lightweight option
2. It keeps others from breaking things
3. It one less thing in the WP menu
4. It’s free of advertising
5. It could make you look cool

Of course, plugins like Custom Post Type UI make it convenient to change on the fly, but you could start with this and later switch to your own plugin later,

Other solutions like Pods, WP Types. Metabox.io could be better if you need other functionality such as more advanced custom fields as well.

The code snippets

Wp Plugin Cp

Wp Plugin Cpt

Here is what you need to add to your my-unique name.php file. You could play safe and only add the plugin name and description.

I believe if your (file) name is already on the WordPress repository and you have a version number you will find that WordPress notification will kick in and could end up updating to someone else’s plugin.

<?php
/*
Plugin Name: An Amazing Product CPT Plugin
Description: Look Mum, I'm a proper developer now.
Version: 1.0
Author: David Waumsley
Author URI: http://davidwaumsley.com/
License: GPL3
License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
*/
// this is where to add the snippets below

You can create your own snippets at GenerateWP or use my saved snippets below:

My “product” CPT snippet is here
My “type” custom taxonomy snippet is here

It’s not working?

In the WordPress backend try going to Setting > Permalinks  and then press the save button.

Plugin developers are likely to add some code to flush the WP database settings, but we are not doing that and can do this one time with resaving the permalinks.

As always I would love to know what you do so feel free to comment below

DWcircle

I build websites at WP Corner Shop and travel. I also co-host a weekly WordPress podcast called WP Builds and make YouTube videos.

2 Comments

  1. Ellie Ellie on 23rd June 2018 at 6:32 pm

    Awesome, I’ve wanted to try making a plugin. This seems like a good one to get my feet wet. :) Thanks, David!

    • David Waumsley David Waumsley on 24th June 2018 at 8:33 am

      Careful, it could be the ruin of you. I must say this as far I have ever got. Thanks for commenting Ellie.

Leave a Comment