Questions tagged [custom-post-types]

Custom Post Types extend WordPress to support additional content.

Filter by
Sorted by
Tagged with
1 vote
2 answers
1k views

Allow Contributor to edit but not update a published post

I have a client that wants to manage the editing process on a CPT called Floor Plan. They want to be able to preview and approve/deny all edits to a Floor Plan. I thought I had a solution by having an ...
0 votes
0 answers
11 views

Custom Block: Adding "Post Type" dropdown to Sidebar Settings

I'm pretty new to React, so I'm trying to find the simplest and most PHP-based way to achieve my goal. What I've accomplished so far Created custom blocks using the @wordpress/create-block package. ...
1 vote
1 answer
3k views

Custom post type Permalinks with hierarchical Taxonomies

I Would use Custom Post Type and hierarchical Taxonomies with same Slug. Fortunately I found a good solution based on post_type_link filter here from TheDeadMedic. mysite.com/products/category1/...
0 votes
0 answers
8 views

How to create a WP Bakery template for a custom post type

I've set up a custom post type for my WordPress website through ACF Pro. I would now like to create a design for the single posts in my custom post type. I'm using WP Bakery on my website and I'm ...
1 vote
1 answer
721 views

re-register custom post type with custom capabilities

I have created custom post type as below. register_post_type( 'connector', array( 'labels' => array( 'name' => __( 'Connectors' ), 'singular_name' => __( '...
0 votes
2 answers
1k views

Using post title in an array

I want to use the the_title() function to get the title of a post and then reference that title in an array. Code is as follows: <?php $title = array( the_title() ...
3 votes
1 answer
697 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 ...
0 votes
1 answer
903 views

How to add a custom button to each field of a Custom Post Types Admin Screen

The best way to show you what I want is a picture: I would like to add a button on the red area in order to create a special action concerning the Chambre1. I was looking foor something similar to ...
1 vote
1 answer
2k views

Allow Editor to view/modify a custom post type

I created three new custom post types and they all work fine for my admin user. A User with the Editor role can see the menu items in the admin, but when they click one it says: "Sorry, you are not ...
0 votes
1 answer
15 views

WP Query filtering by custom category not showing all relevant posts

Here's a question I've been trying to solve all day: I added a WP Query that would show posts from a category that the admin chooses with a custom field. The post is a custom post type called "...
0 votes
0 answers
18 views

Custom post type slug localization

I need to have 2 languages in a website (EN and LT). I have a custom post type 'services'. I need to have the links like this: English version of the service: '/en/services/some-service' Lithuanian (...
0 votes
1 answer
671 views

Change dynamically the dropdown list value

I have a form where i list a related custom post type by ID of the parent custom post type on a checkbox list like the picture. so when i check an option to 4 options i want to have a list of the ...
0 votes
1 answer
865 views

Use WP_query to match post types based on custom field values

i'm trying to query posts from the post type Product that match with the current post in the loop from the post type Item, based on the custom fields product-ean and item-ean. For example: i have a ...
1 vote
1 answer
1k views

How to Upload CSV Data into Custom Post Type Data with Metabox programmatically

I have a Custom Post Type called movies which had only title enabled from post support and 3 custom field of metabax as box office, year, and director like now I have like 150 rows CSV formatted ...
-1 votes
1 answer
27 views

Add taxonomy or category slug to custom post types URL

I have created a custom plugin that is similar to Woocommerce but will only manage products that are loaded using the WP REST API in a Vue SPA. I've registered two custom post types, one for products ...
0 votes
1 answer
1k views

Add featured image programatically to custom post type

I am trying to automatically add a video thumbnail from Vimeo or YouTube as the featured image when a new custom post type video is add/updated. The video ID is an advanced custom field. Here's my non-...
1 vote
3 answers
1k 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 ...
1 vote
1 answer
686 views

Order a custom post type admin screen by a second custom post type title

I have two custom post types: Products and Brands. The Product slug is 'eproduct'. The Brand slug is 'brand-listing'. On the Product admin page, I have added a custom column that lists the Brand ...
4 votes
5 answers
10k views

Make future posts visible to the public—not just within WP_Query

I know I can publicly show future posts in a loop using 'post_status' => 'future' in WP_Query. But clicking on a future post's permalink will result in a 404 if you are not a logged-in user. ...
0 votes
2 answers
1k views

WordPress hook which triggers on post import

I am adding few meta fields for product post type using wp_insert_postaction and it is working perfectly. But I have to trigger my function upon product imports as well as this action is not firing ...
2 votes
3 answers
18k views

Display posts of only a certain category in WP Admin section?

I want to add a new menu point to post that shows posts of a certain category. Adding a new page is easy if it is just a new post type. But I want to only show posts with a specific category and when ...
0 votes
1 answer
1k views

ACF - Retrieve custom taxonomy from a relationship field

I have a custom post type, called prognosis with 3 custom taxonomies, Country, Competition, and Sport, I've also added a few ACF custom fields. I have another custom post type called analysis with an ...
0 votes
2 answers
886 views

Custom metabox with image gallery upload that won't attach images to post

I have created a custom metabox with an image uploader that will upload multiple images into a gallery that I can then query. It all works accept for the fact that the images don't show as attached to ...
0 votes
1 answer
1k views

List all posts from custom post type by taxonomy

Having custom post types with taxonomies. Lets say I have a custom post type "Products" with taxonomies "new", "old", "fashion". Now I have a Nav where I can click on wordpress.private/products/new/...
0 votes
0 answers
6 views

custom post type dynamically shows in menubar in wordpress

I am developing a hospital website in wordpress. For that I make a custom post type "Services". All the hospital services (ex:ICU, CCU, NICU, Emergency etc) are going under this "...
1 vote
1 answer
743 views

Rewrite Rule & Regex - Extract 'cat-name' and 'page-number' from http://domain.com/custom-post-type/category/cat-name/page/page-number

I have an URL formatted so: http://domain.com/custom-post-type/category/cat-name/page/page-number I need to extract: cat-name and page-number So that in my functions.php, I can create the custom ...
1 vote
1 answer
758 views

Custom Post Type with Same Page URL

I have set up a page with the URL slug "announcements" I also have a custom post type with the rewrite set to the same name: 'rewrite' => array('slug' => 'announcements'), This all works fine....
0 votes
1 answer
2k views

Advanced search form with multiple custom fields

I'm working in a site that allows to search for lawsuits about medical malpractice, the client wants to have a search form almost equal to the one in this site: http://psychcrime.org/database/ All ...
0 votes
0 answers
17 views

Wordpress next/previous post link

I need help, please. I'm a newbie on Wordpress. This code is working: $previous_post_url = get_permalink(get_adjacent_post(false, '', false)); $next_post_url = get_permalink(get_adjacent_post(false, ''...
0 votes
3 answers
2k views

Assign a Post to a User

1 - I have a CPT, with 10 posts. 2 - I have 10 users Q : How can i assign a single post from my CPT, to an unique user ? -> Each user must see only it's assigned post (Each post will be assigned by ...
0 votes
2 answers
685 views

Hierarchical Custom Post Types

I would like to have the following taxonomy structure: site.com/courses/course-name/pathway/pathway-name The domain is such that any particular course can be completed by taking a number of ...
1 vote
1 answer
2k views

How to create a custom post type with additional fields?

Beginner's question: Looking for example how to create a custom post type with additional elements. What I mean is: in my code I have a basic stuff like 'title', 'editor' ... but I need also for ...
0 votes
2 answers
842 views

Custom post type and google visibility

I have a WordPress site that uses custom post types. However, the custom post types are not being recognized by google. It's like the custom post type is a box full of our original content that google ...
0 votes
1 answer
1k views

Populate custom post type/custom fields from an external database

I have a custom MySQL DB(same host/different domain) with a lot of vehicle information. What we want to do is populate a custom post type and custom fields with this data so that it's SEO friendly in ...
0 votes
2 answers
934 views

Custom post type defaults to index.php for archive page

I've developed a custom theme with a custom post type named events. For some reason, however, WP refuses to use my archive page template with the file name archive-events.php per WP's template ...
0 votes
1 answer
2k views

How to add custom supports for custom post types?

I need to define a custom support feature for my WordPress Plugin but I can't find how to do so. What I want to do is to display a box on certain custom post type containing 2 meta fields in which ...
0 votes
1 answer
683 views

Post Click Redirect to Custom URL instead of Single Post Page

I have a custom post type called "articles". When an article link is clicked, I want to redirect them to custom URL(this URL is saved in the database as custom field) instead of the single page. How ...
1 vote
1 answer
835 views

Programmatically rewriting slug through functions.php but returns 404

I wanted to change the slug of a certain post type (in this case, article) into whatever a certain value in its custom field. I went to functions.php and put this code. function na_remove_slug( $...
0 votes
0 answers
18 views

get_posts() return NULL using a custom plugin and add_submenu_page() with Post Type

Inside a custom plugin and using add_submenu_page() for custom post type I want to display one post. As the other post_type I use get_posts($the_id, $arr_params) to get information about it, except in ...
0 votes
1 answer
673 views

Automatically add CPT UI categories to the menu

I have created a CPT UI and selected built in taxonomies "categories (WP CORE)". I have added some records and every time I add a category and main record, I want them to display in the main menu ...
0 votes
1 answer
708 views

How to display only child category post in related posts in custom post type?

I'm trying to display only those posts which are under the same category of the post which I have clicked as related posts. My custom taxonomy are like this : Fsc year 1 => Biology => Bio chapter 1 . ...
1 vote
3 answers
5k views

Filter custom posts by multiple taxonomies

Im working with custom post types - named 'Products' I have multiple taxonomies registered - 'Category' and 'Dosage' And I'm trying to setup pages that only display custom post types 'products' IF ...
0 votes
0 answers
7 views

Quiz page template, checked attribute missing when option selected

I would like to add a quiz page template to my WordPress site. Part of the template is the code below. The problem is that when any of the inputs is selected, the checked attribute is missing. <div ...
0 votes
1 answer
2k views

add action save post type and update post meta woocommerce

I want update post meta in product woocommerce when I save o update the product. I write this function (and insert in functions.php) with save_post_NAME_CPT but don't work. add_action('...
0 votes
1 answer
13 views

Why does have_posts() return false when in the wordpress admin, but not on the frontend?

Background: I'm new to the Gutenberg block editor and I'm trying to develop a custom block theme. I'm using ACF to create custom blocks. Problem: I'm creating custom blocks with the intention of ...
0 votes
3 answers
1k views

Query posts by multiple custom fields

I have made two dropdown list which is a custom fields. Custom Field 1 :- industry Values of Custom Field 1 :- financial_services,ecommerce,insurances, etc. Custom Field 2 :- primary_functionality ...
0 votes
1 answer
782 views

Add an array as post content dynamically

I am working on a code where I need to insert the array as the content in wordpress admin . I am using below code $newArray = array(); $new_post = array( 'post_type'=>'post', '...
1 vote
3 answers
2k views

Custom Post Type Permalink

I need help with structuring permalink for the custom post type that I made. I think I tried all the answers here. I'm hoping somebody can help me. More Info The custom post is looks like this in ...
1 vote
2 answers
693 views

browse by category and tags?

I have a custom post type called freebies. This custom post type has its own taxonomy with the "normal" categories from wordpress, (which are child-categories from freebies) and own custom taxonomy ...
0 votes
1 answer
684 views

Ordering Post by Meta Key (Not Working)

So I've read all the stack exchange posts on this, and I feel like what I have, based on what I've read, should be working. I'm a little confused as to why it isn't. $args = array( 'post_type' =&...

1
2 3 4 5
206