Questions tagged [custom-post-types]

Custom Post Types extend WordPress to support additional content.

3,173 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
7 votes
0 answers
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', '...
user avatar
  • 79
6 votes
1 answer
2k 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() { $...
user avatar
  • 61
6 votes
1 answer
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/...
user avatar
  • 61
6 votes
1 answer
2k 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: ...
user avatar
5 votes
0 answers
2k 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 ...
user avatar
  • 51
4 votes
0 answers
176 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' =&...
user avatar
  • 1,637
4 votes
0 answers
332 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 ...
user avatar
  • 141
4 votes
1 answer
651 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 ...
user avatar
  • 113
4 votes
1 answer
1k 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')) { ?&...
user avatar
  • 149
3 votes
0 answers
43 views

WordPress Rest API only returns content when posttype has editor capability

I am trying to request my post via the WordPress V2 Rest API in the backend. For whatever reason the post content is only returned when my custom post type has the editor support enabled. Is there a ...
user avatar
3 votes
0 answers
886 views

ACF Upload Image in repeater from front-end with custom form? - add_post_meta()

I want to upload images in the ACF repeater. That repeater means the gallery of page. Point is to create post in custom post type using add_post_meta() method. Here I have the form : <input type=...
user avatar
  • 165
3 votes
0 answers
509 views

How to delete all posts from a custom post type?

I want to delete all posts from a custom post type "TV-Serie". The number of all posts in this post type are 150,000. Moreover, when I try to delete them all manually while selecting more than 500 ...
user avatar
3 votes
1 answer
741 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 ...
user avatar
  • 31
3 votes
2 answers
2k 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. ...
user avatar
  • 131
3 votes
0 answers
359 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 ...
user avatar
  • 31
3 votes
1 answer
107 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 ...
user avatar
3 votes
1 answer
122 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 ...
user avatar
3 votes
1 answer
208 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 ...
user avatar
  • 415
3 votes
0 answers
2k views

Adding description to archive of Custom Post Type

Im battling to add a description / introduction field to the top of the archive of my custom post type. I manage easy with with ACF's option page, but I would like to do without ACF. I have managed, ...
user avatar
3 votes
0 answers
278 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-...
user avatar
3 votes
0 answers
63 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>&...
user avatar
3 votes
0 answers
599 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 ...
user avatar
3 votes
0 answers
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 ...
user avatar
  • 131
3 votes
1 answer
455 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 /****************...
user avatar
  • 600
3 votes
0 answers
55 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 ...
user avatar
  • 31
3 votes
1 answer
2k views

How to set custom post type as post title to avoid 'Auto Draft'

I am using a mixture of Advanced custom fields plugin and Custom post type UI to give my users some extra functionality. The problem I have is that I have serup a testimonials menu and in the list ...
user avatar
  • 277
3 votes
0 answers
183 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( $...
user avatar
3 votes
0 answers
1k 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 ...
user avatar
3 votes
0 answers
2k 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 ...
user avatar
3 votes
1 answer
621 views

register_post_type - rewrite / feeds, what's it for?

The codex page for register_post_type seems to suggest that it should be possible to disable feed generation for custom post types: rewrite (boolean or array) (optional) Triggers the handling of ...
user avatar
3 votes
1 answer
1k views

Get list of terms of current taxonomy archive for another taxonomy

I have a Custom Post Type named 'Real estate' which has (amongst others) two different taxonomies: 'Purpose' (hierarchical; terms used are 'Living', 'Working' and 'Holidays') and 'Location' (non-...
user avatar
  • 310
3 votes
2 answers
1k views

Changing a custom post type "has_archive" after registered

Ok, I've seen some similar posts on how to change a custom post type's attributes after it has been registered (in my case, I'm trying to modify a custom post type created by a plugin without ...
user avatar
3 votes
1 answer
824 views

Parent page for CPT

Alright, there's been numerous topics about this, but it doesn't seem to work for me. I have one normal page, called "Resources". Then I have several Custom Post Types. One of which is "...
user avatar
3 votes
2 answers
6k 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:...
user avatar
3 votes
3 answers
881 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 ...
user avatar
  • 53
3 votes
1 answer
2k views

WordPress import not importing custom taxonomy

I've posted this already in the WP Support Forum hoping to have more luck here. I'm trying to import a custom post type from one blog to another. (126 posts in the custom post type). I've exported ...
user avatar
  • 305
2 votes
0 answers
29 views

Custom Post Type not appearing in website search

I've built a custom theme from scratch for a client and have a few custom post types. For one in particular, FAQ, I wanted to hide it from showing individual posts (posts would only appear on its ...
user avatar
2 votes
0 answers
115 views

Custom post type capabilities require "create_posts" to access the edit posts list page

I have a custom post type and a custom user role that I want to be able to do everything but delete and create this post type. However, this user role can't view the dashboard's list of posts for ...
user avatar
2 votes
2 answers
42 views

Permalinks without post type

I use norebo theme I use it when I open a Portfolio the link is in this format https://www.hshnorm.com/project/fruit-flavored-powder-juice/ How can I remove the word project To be the link in this ...
user avatar
2 votes
0 answers
229 views

Show Post Count of a Category

I've been stuck on this for a little while now, and have tried multiple ways to achieve this with no luck. I've been looking for two ways to display the total posts found on a specific, and non-...
user avatar
2 votes
0 answers
68 views

Registration and Custom Post Types - How to synchronize information?

I am building a platform where service providers can offer their services to potential customers. Therefore, I have two user roles, one "customer" who can only create an account and read; ...
user avatar
  • 21
2 votes
0 answers
476 views

Gutenberg Featured-Image-panel missing when user with custom role edits Custom Post Type

For a Wordpress project I made a Custom Post Type in the usual manner. Also i made a custom role. I want users with that role to be able to make, edit and delete this CPT. I added the apropriate ...
user avatar
2 votes
0 answers
59 views

How to get images from EDD post?

I use Easy Digital Downloads plugin and I wish to get images from the downloads posts types! But with my code, nothing return! Someone for help? <?php $attachments = get_posts( array( 'post_type' ...
user avatar
2 votes
0 answers
299 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 ...
user avatar
  • 894
2 votes
0 answers
1k views

Adding a Gutenberg-like custom field on a custom post type

I've googled this a bunch, there's a couple of answers for old versions (pre-gutenberg) of Wordpress but none that I could find for Gutenberg. Essentially I have a custom post type I added by editing ...
user avatar
2 votes
0 answers
255 views

Meta query for custom post type ignored in main query

I looked through the interwebz but couldn't find a solution. I am creating a website with custom post types where posts also include custom post meta (through ACF). I am creating an archive file and ...
user avatar
2 votes
1 answer
1k views

Hyphens instead of Underscores in Post-type Archive Template Filenames when Post-type handle contains underscore

I'm working on implementing WordPress coding standards on a theme which has several custom post-types, each of which have underscores in their handles. The theme uses the custom post-type handle in ...
user avatar
  • 1,258
2 votes
0 answers
194 views

WP_Query search posts by custom post type and custom taxonomy

I have custom posts articles with custom taxonomy tags-articles, I need search all posts with have the term in title, or taxonomy associated with same title (or partial title): Example os published ...
user avatar
2 votes
0 answers
324 views

Why does using WP_Query inside a shortcode in an elementor page cause the arguments for WP_Query to get malformed?

I am trying to embed a custom WP_Query inside a shortcode I have activated on one of my pages (created in Elementor). I have a Custom Post Type called 'inspector-profiles', and for some reason when I ...
user avatar
2 votes
0 answers
201 views

Limit users by custom taxonomy and user roles

This is not duplicated post! I working on the custom theme and have 2 taxonomies: bezirk and ortsgruppen. bezirk acts like main group and ortsgruppen is the sub group under bezirk. I need to asign ...
user avatar

1
2 3 4 5
64