Questions tagged [custom-post-types]

Custom Post Types extend WordPress to support additional content.

2,902 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
6
votes
2answers
2k views

Filtering a custom post type by custom taxonomy in archive template

I've seen this question posted in different forms before, but most of those solutions are centered around the admin interface, and I haven't found any answers that apply to the front end. I've got a ...
6
votes
0answers
2k views

add_rewrite_endpoint() not working for custom post type archives

i'm working on somekind of wiki/encyclopedia system based on wordpress. there are two custom post types. i'll show my configuration for one of them: $labels = array( 'name' => _x('Objects', '...
5
votes
0answers
1k views

Fetching private posts or custom post types via WP-API with basic authentication

I've installed WP-API along with Basic Auth. I'm able to fetch cpt posts using curl http://siteurl.com/posts?type={post-type} However, if I change a post to private, it is no longer returned. This ...
4
votes
1answer
612 views

Custom taxonomy query for a custom post type

I have a custom post type called news with a custom taxonomy called news category. Right now I have a template called taxonomy-news_category-press.php where press is one of the news_categories. The ...
4
votes
1answer
979 views

Add category to custom post URL

I am trying to create custom post with custom taxonomy and categories. Structure is like: Product: Has categories Has taxonomy Custom post type create: function create_alco_custom_post() { $...
4
votes
1answer
1k views

How do I display two separate taxonomy archives for two post types that share a single taxonomy?

I have a custom content type, "products", which shares the category taxonomy with posts. We're using posts to discuss and review products. The idea is to have two separate URLs: /discussion/...
4
votes
1answer
4k views

Ordering posts by custom taxonomy in admin area

EDIT @kaiser - this question is slightly different to the answer you posted in that I am talking about sorting by clicking the column title rather than adding a dropdown to filter by taxonomy term (...
4
votes
1answer
1k views

Admin Area Custom Type Search By Meta Fields Without Title & Content

I have a custom post type that uses several meta fields. In the admin area I would like to be able to search by those meta fields. I have implemented this currently in my functions.php with this code: ...
3
votes
0answers
56 views

Lock post meta block at the bottom of a custom post type

I'm using the template feature of Gutenberg to add a post meta block (with a couple of input fields) at the bottom of a custom post type: $args = array( 'show_ui' => true, 'show_in_rest' =&...
3
votes
0answers
241 views

Linking three taxonomies with ACF

I'm creating a product finder using a CPT called "Products", which is already used for displaying products separately on the site. The product finder is based on a answer and question idea, where the ...
3
votes
1answer
471 views

Custom Queries: Joining On Meta Values From Two Custom Post Types

Hi – I'm hoping this is the right place to be asking this question. I am in the process of moving my full football club website onto Wordpress, therefore using a single database for the information ...
3
votes
1answer
93 views

Adding a span when custom post type is updated

What I'm trying to do is have a span tag appear on the top of the post type whenever the post is updated. The way the page is setup, there is a query of different post types that list jobs currently ...
3
votes
1answer
113 views

Remove “-2” from a Toolset Types URL with the same post name

I'm using Toolset Types to create a custom post type, and within that post type there is a taxonomy. I have created two posts with the same name, but in a different taxonomy. For the purposes of ...
3
votes
1answer
195 views

Page to display an archive of taxonomies

My website needs to have two custom post types and each of these has two custom taxonomies with several terms each. These terms also have to be hierarchical. My problem is, that I don't know how to ...
3
votes
0answers
172 views

No checkbox in wordpress posts list table for CPT

I have added a Custom Post Type as follows add_action( 'init', 'codex_book_init' ); function codex_book_init() { $args = array( 'description' => __( 'Description.', 'your-plugin-...
3
votes
1answer
829 views

has_term or in_category for Custom Post Types

I have property as a custom post type. I want to display a specific message if the property is in the sold category. To do that, I'm using the function below: if ( has_term('sold', 'category')) { ?&...
3
votes
0answers
60 views

Select menu should display categories and the item's depth

I have a select menu of a custom post type in the header.php: <?php $selectloop = new WP_Query( array( 'post_type' => 'products', 'posts_per_page' => -1 ) ); echo '<form>&...
3
votes
0answers
481 views

Custom Post Type relationship with hierarchical parent and child permalinks

Trying to get my permalink and url structures to behave nicely. I have a Custom Post Type called Diseases. This post type is hierarchical with parent and child relationships. I have another CPT ...
3
votes
0answers
2k views

Category base to url in custom post type/taxonomy

I'm building a recipe site that uses custom post types for recipes. So I searched for including the custom post type categories in the url and found a solution below by Milo. It rewrites the url and ...
3
votes
1answer
163 views

Custom Taxonomy and tax_query Issue?

I am working on Plugin development and my plugin name is plugindev.I have a custom post type called team.I have a custom taxonomy Team_Category which is being registered by this code /****************...
3
votes
0answers
50 views

How to show custom taxonomy in the permalink?

I used the Portfolio Post Type Plugin to create custom tax and post type. I would like to show the custom taxonomy on the portfolio projects. portfolio/customtaxonomy/project while now is ...
3
votes
0answers
174 views

How to create a repeatable / reusable divs in the metabox?

I have a meta box: <?php function custom_meta_box_markup() { global $post; $meta_box_text = get_post_meta( $post->ID, 'meta-box-text', true ); $meta_box_text_day = get_post_meta( $...
3
votes
0answers
954 views

Create Custom Post Type Archive Page with Sub Categories Navigation Sidebar

I have 8 custom post types (which are actually for 8 different blogs and used as "blog landing pages"). Each custom post type is also a Blog Category and each has several sub categories to it. For ...
3
votes
0answers
1k views

How to add meta boxes(repeater fields) from WordPress back end?

I have a custom post type 'service'. Each service will have items. For each item there would be 'name of item' and 'price'. Earlier i created meta boxes for 5 items i.e 10 meta boxes in total, which i ...
3
votes
2answers
4k views

Displaying Meta Box Image

I have some problems displaying info from my custom meta box in my custom post type single. I'm using Reusable Custom Wordpress Meta Boxes by Tammy Hart. I'm able to display the textfields using this:...
3
votes
3answers
822 views

Unable to get wp_redirect() working after adding a CPT via the front end

I am attempting to learn PHP by creating a relatively simple application built on wordpress, it is a basic CRM and I've made decent progress but have been stuck on some of the finer points. I've been ...
3
votes
1answer
6k views

how can I create a calendar for a cpt, using get_calendar or other

I have a custom post type with its own date field. the date is setup for unix YYYY/mm/dd I need to create a simple month calendar that shows days that have a cpt on them. get_calendar works for ...
2
votes
0answers
25 views

Set Custom Image Size Just For Specific Custom Post Type

Looking at the heading of the question it may seem like a duplicate question, but it is not. Let me explain a few things before anyone downvote or make it a duplicate. As far as I know in WordPress ...
2
votes
0answers
41 views

get_queried_object error How to show post count by month in the taxonomy page

Can anyone help me please. i want to show custom post type count by month of taxonomy in archive page for current year. Example: January 24 February 43 March 5 April 6 and etc. This code is help ful ...
2
votes
0answers
53 views

WordPress Custom Post types and Taxonomy relationships best practices

Given that a Custom Post Type (CPT) has properties geared towards a UI on the front end and a taxonomy is a data object which allows for easy association of a post type and a set of terms (which can ...
2
votes
0answers
401 views

Notice: Undefined property: stdClass::$delete_posts with custom post type

I created a custom post type called gdpr_qao and I set 'capability_type' => array( 'gdpr_qao', 'gdpr_qsaos' ) in register_post_type arguments. On main custom post type screen I get: Notice: ...
2
votes
0answers
27 views

I am facing problem in my archive page , it is partially working

I am using wordpress 5.1 and I am creating a blogging website. I am having an issue in my blog posts: when I click the permalink(link) of category it is showing the output but when I click the author ...
2
votes
0answers
17 views

Custom posts filters in admin

I create a custom type post and categories for them. I tried to make filters for this custom type posts. But it doesn't work. I don't know what is wrong in my code add_action( 'init', '...
2
votes
0answers
46 views

List custom post type by custom tax term as page title

I have a page called "Developments" and I want to list all the Project posts by the custom tax Project Type using the page title as the term. This doesn't work: <?php $title_slug = ...
2
votes
0answers
142 views

How to add button to post page WordPress 5.x

How can I add a button to a posts page? what hook can be used to add a custom button I'd like to place it next to, or near, the "Publish/update" button, or modify the publish button for triggering ...
2
votes
1answer
330 views

Bulk 301 redirect for custom post type

I've amended the URLs for my custom post type from: url.com/jobs/job-name to url.com/jobs/job-location/job-name Problem is, because this isn't a standard rewrite wordpress doesn't do the 301 ...
2
votes
0answers
53 views

Check Title Unique Or Not and If not error message and dont save

i am get tired from searching 2 days for what i wanna i have 'area' custom post type have Title and another field i wanna the title of area is unique if the user enter title 'area1' and this title ...
2
votes
1answer
719 views

Enabled Revisions to existing custom post type not working Wordpress

I am trying to enable revisions for an existing custom post type. As the post type was already created about 2 years ago so where the post type was register I added revisions to the supports array. ...
2
votes
0answers
627 views

Woocommerce query specific product from specific category

I'm trying to create a shortcode that will show a woocommerce product via just a shortcode. I want the shortcode to take 1 parameter that is either the ID or slug of the actual product. Preferably ...
2
votes
0answers
69 views

Output the content of a term organised by each of the CPT?

I have four CPT and several shared Custom Taxonomies for all. I need to retrieve and output the content of a term (let's say "environmental-crisis" of the shared taxonomy "Crisis Type", and organise ...
2
votes
1answer
104 views

Developing Wordpress on Kubernetes

I'm currently researching how to develop a Wordpress site on top of Kubernetes. I would like to be able to develop Wordpress sites while the live site is running in production. However this would ...
2
votes
3answers
307 views

Permalinks when filtering multiple custom post types by single taxonomy

I've been working with Custom Post Types and Custom Taxonomies for ages but one thing I can never get right are the rewrites when applying a shared taxonomy to multiple CPTs. For instance, I have ...
2
votes
1answer
334 views

Disable WordPress Recognizing Path as Attachment

Whenever you enter an URL with two path segments that doesn't exists, WordPress will automatically parse the query as an attachment. How to reproduce Change you permalink structure to /%postname%/. ...
2
votes
0answers
1k views

Filter custom post type archive page with custom taxonomies (categories) with AJAX

I've created a custom post type (projects) with different custom taxonomies (projects' categories). I would like to create a categories' filter but with AJAX, so without reloading the page every ...
2
votes
0answers
389 views

Custom Role for CPT Only

I have removed admin specific capabilities for the custom role however they can still delete admin published listings. I only want people with the custom role of submit_listing to be able to submit ...
2
votes
0answers
289 views

Issue to get wp_get_attachment_image with cmb2

I have a problem get the image with cmb2, I have tried in many ways without successm according to the documentation, this is fine, what can I be doing wrong? add_action( 'cmb2_admin_init', '...
2
votes
0answers
303 views

removing custom tax & CPT slug, adding taxonomy term in front of custom type

I am having difficulties setting up the following structure in Wordpress: site.com/custom-taxonomy-phase-term/ (taxonomy page but without the taxonomy slug) site.com/custom-taxonomy-phase-term/...
2
votes
1answer
60 views

How to have the right design for a custom post type without accessing themes

I am trying to create a music player plugin for WordPress. Using custom post types, and custom fields, I could make posts that takes a URL and artwork. The player works based on jQuery and once the ...
2
votes
0answers
78 views

Passing parameters to Wordpress static front page

I have a custom plugin that shows a series of custom posts on a page, i.e. http://www.example.com/permalink/ On that page I have a form to filter the posts according to a number of different ...
2
votes
1answer
20 views

I am trying to output portfolio items with a picture. This code doesn't seem to be working. What am I doing wrong?

<?php $temp = $wp_query; $wp_query = null; $wp_query = new WP_Query(); $wp_query->query('showposts=21&post_type=portfolio'.'&paged='.$paged); $count = 0; while ($wp_query-&...

1
2 3 4 5
59