Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [custom-post-types]

Custom Post Types extend the WordPress back-end to support additional, non-Post content.

3
votes
0answers
89 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
0answers
67 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 ...
3
votes
0answers
76 views

How to create another version of the Category widget?

I need to handle both Brands and Categories in WordPress. So I thought I would create a new copy of the Category widget – just with Brands. I've tried various workarounds, including tags, custom ...
3
votes
0answers
266 views

Order Wordpress Custom Taxonomy Pages & Pagination Not Working

I'm using this code to enable custom post types and taxonomies on my site (I've also included this below to save linking out) https://gist.github.com/kasparsd/2924900 The code works great for the ...
3
votes
0answers
117 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
0answers
609 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
59 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
413 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
0answers
49 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
170 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
850 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

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 ...
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 ...
2
votes
0answers
29 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
127 views

Creating conditional blocks for WordPress Gutenberg

I've been reviewing tutorials on creating blocks for Gutenberg but I am unclear how to handle a particular use case - conditional blocks. I am looking at creating a custom post type for which I will ...
2
votes
0answers
31 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
0answers
42 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
0answers
279 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
177 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
179 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
0answers
234 views

Custom post type editor with dynamic selects, one drop down populating a second second drop down not working

I have a custom post type where I am attempting to have one select populate the options of a second select in the custom post type's editor. The first drop down pulls in a list of tags associated to ...
2
votes
0answers
40 views

Assign External Database Queries to Global Variables and Make Them Accessible

I've got a bit of a tough question involving a website and its web app counterpart. The Background The website relies on two different databases: its default, named wp_website, and its counterpart's ...
2
votes
0answers
77 views

I am having a problem with form updating/editing Wordpress post on the frontend

I am having a bt of a problem trying to allow users to edit their own posts (custom post type) on the front end. the form is being displayed and errors are displayed but the form is not updating the ...
2
votes
0answers
68 views

Adding the taxonomy before the custom post type

I have a custom post type named landings which has a rewrite rule to change the slug to loans and a custom taxonomy provinces and I want the custom post type to have the slug of the province in the ...
2
votes
0answers
32 views

How to filter out post type meta?

I have used this code to filter out the post type and it works fine when showing filtered results: add_filter('wpseo_title', 'vehicle_listing_title'); function vehicle_listing_title( $title ) { ...
2
votes
0answers
874 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, ...
2
votes
0answers
89 views

How to rename image at uploading on specific plugin or post-type in WordPress

I am working on a plugin. In plugin, there is a custom media uploader. All images upload successfully. Then I want that when I upload images its renamed, so i get this code and write it in my plugin ...
2
votes
0answers
118 views

Add custom capabilities to existing custom post type

The only way I can find to associate post types with custom capabilities is during the register_post_type function. I'm looking to add a capability for a certain role (my_role) for a post type that ...
2
votes
0answers
487 views

Custom WP TItle from custom template with dynamic URL structure

I am new to custom WP development, but I have made a custom plugin. With a custom rewrite I have made the following URL structure: /profile/[company_name]/ I have made a new post Profile with a ...
2
votes
0answers
2k views

Export Custom Post Type posts with all Custom Fields and Custom Texonomy associated with it

i have question: I've created a custom post type name "product" and i have many custom fields and Custom Texonomy associated this "product" with it like: images, extra description, type, size and many ...
2
votes
0answers
350 views

How to Combine Two Custom Post Types into Single Permalink Structure

The website uses - A) A hierarcical Custom Post Type "Destination" to support the following structure, so each tier of the hierarchy could have its own unique destination guide: Territory - ...
2
votes
0answers
897 views

Pretty URLs for Custom Post Type & Custom Taxonomy with Duplicate Slugs on WPML

I'm interested getting some help for a rather complex setup. I'm working on a publication and interested in creating a special subsection with a custom taxonomy. Think of this as an editorial ...
2
votes
0answers
1k views

Custom Post Type and Custom Taxonomy Permalinks

I'm currently working with a client's Wordpress blog that has a permalink structure set in the admin settings as "/speaks/%postname%/". This is so that all actual blog posts (post_type=>posts) have ...
2
votes
0answers
878 views

Can I change the slug of my archive page on a Custom post type?

I have a CPT with a slug that is the same of a page. This has been done on purpose as I hope I was able to control the slug of my archive page to be something like http://www.test.me/page http://www....
2
votes
0answers
781 views

Custom Posts Hierarchy? (State/City/Restaurant)

Question: What is the best way to create a hierarchy structure (also called parent/child relationships) between custom post types? For example, we currently have 3 post types: States, Cities, and ...
2
votes
0answers
2k views

Custom Post Type with two hierarchical Custom Taxonomies: strategy to generate best permalink structure

this is my situation: I have a Custom Post Type named struttura (like accommodation): function custom_post_struttura() { $labels = array( 'name' => _x( 'Strutture', '...
2
votes
0answers
1k views

Featured image metabox not showing up

I have a theme installed on WordPress Multisite 3.5.1 which has a one custom post. Now I wanted to have two more so I have created them. Everything is working besides one thing. The featured image ...
2
votes
0answers
2k views

query_posts with a custom post type, a meta_query and sorting by post date?

I've searched the archives and found questions similar to what I need, but haven't found exactly what I want. I've got a bunch of products that are sorted by a meta_key of country, and I'd like to be ...
2
votes
0answers
768 views

Hierarchical Custom Posts - Highlighting Current Post in Sub-Menu

I have created a hierarchical custom post type called events and have used wp_list_pages to list the sub-posts for each event post (See below). This navigation works great, but I cannot figure out how ...
2
votes
0answers
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 ...
1
vote
0answers
52 views

How to filter by custom post type on Gutenberg "Latest Posts' block

When adding the "Latest Posts" block within Gutenberg, is it possible to filter by custom post type? Here are the options I can see: Would I need to create a custom block for this type of ...
1
vote
0answers
22 views

Wordpress custom taxonomy, posts urls

I have a custom taxanomy and posts. On my site there are categories and subcategories. Now URLSs look like this: post: domen/product/lorem-post/ category: domen/category/lorem-category/ sybcategory: ...
1
vote
0answers
13 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', '...
1
vote
0answers
27 views

Removing custom post type slug from URL

I want to remove custom post type slug from URL and for this I have used this solution Removing slug from custom post type URL It is working fine but I also want to add category with custom post type ...
1
vote
0answers
103 views

How to display “Category and Post_tag” component in a CPT Gutenberg edit screen?

I want to use Categories and Tags everywhere in WP (Articles, Pages, Attachments and CPT like for example Jetpack-Portfolio) I have been able to show these 2 core taxonomies (category and post_tag) ...
1
vote
0answers
40 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 ...
1
vote
0answers
37 views

Custom Post Type not showing in Rest API on Multisite

I'm using WP Multisite and can't seem to pull through my custom post types via the API. <?php function terms_post_type() { $labels = array( 'name' => _x( 'Policies', '...
1
vote
0answers
44 views

post meta parameter in post custom-post-type endpoint with restapi

I'm trying to create a new custom post via the native Wordpress REST API POST /wp-json/wp/v2/CUSTOMPOST at the moment I used the wp-rest-api-controller plugin to activate the endpoints the custom ...
1
vote
0answers
21 views

How can I made custom taxonomies relationship?

I create two custom taxonomies: Category (Cars, Pets etc). Region (New York, Washington etc). Now I need to do archives like {Category} in {Region} (for ex. Cars in New York) and get slugs for it (...