Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now

Questions tagged [custom-post-types]

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

Filter by
Sorted by
Tagged with
0
votes
1answer
23 views

I want to fetch custom post data based on it's id i fetch from select drop down [closed]

i want to display a particular post data on same page through its id when i change value in select. the code for select is done and somewhat like below after which i am stuck can i get any help on how ...
1
vote
1answer
14 views

tax_query returning all posts instead of selective posts in WP_Query

What I am trying to do Hi, in my site I have a custom post type called projects, then I have created a custom taxonomy for my projects post type called project_catagories. Now in my projects archive ...
0
votes
0answers
24 views

How can I include a option submenu page on my custom post type menu?

I have this custom post type: // Register Custom Post Type Marca function create_banner_cpt() { $labels = array( 'name' => _x( 'Banner', 'Post Type General Name', 'sc-slider' ), ...
0
votes
1answer
28 views

Query first and last name from custom post type

I want to query first and last name using custom post type metaboxes. Code i am using: $name = 'John Doe'; $args = array( 'post_type' => 'customers', 'post_status' => array( '...
1
vote
0answers
38 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 ...
0
votes
1answer
22 views

Maintaining strict one-to-one association between terms and custom posts

I'm building an inventory system where inventory items have their own page but where standard WordPress post post types can also be tagged with these inventory items. As far as I understand, this ...
0
votes
1answer
41 views

Custom rewrite to fetch feed data

I am trying to fetch and display data from a feed when the user goes to a specific url like /items/32 where the 32 is the actual id of the feed item that should be fetched and displayed. Notice that I ...
0
votes
1answer
58 views

Warning , Use of undefined constant PLUGIN_PATH?

I having a warning in my error log Use of undefined constant PLUGIN_PATH - assumed 'PLUGIN_PATH' (this will throw an Error in a future version of PHP) When I googled it I couldn't find the ...
0
votes
0answers
13 views

Add directory slug to the post (but not custom post type) permalink structure [duplicate]

I'm having an issue trying to set up the default posts post type to use the permalink structure of /news/%postname%/ - I've tried editing the permalinks but it throws out my other custom post types. ...
0
votes
1answer
52 views

YOAST SEO won't work on custom post type archive [closed]

I created my custom post type page (archive-objects.php). This page works fine, I have been created page for it and attributed template to it. So everything is okay. But something wrong is with YOAST ...
0
votes
1answer
22 views

How can I add image sizes for a specific custom post type?

What I'm trying to achieve is to define a specific image size (a portrait thumbnail) for a specific post type (books), so that only this post type has this thumbnail size generated and I'm not wasting ...
0
votes
0answers
24 views

bad practice for Custom Post Type

I created my CPT along with your category ... It's a bad practice to do this? in register_post_type: rewrite => array ( 'slug' => 'portfolio/work' ) in register_taxonomy: rewrite => array( '...
0
votes
0answers
15 views

how to create a custom xml export for custom post types

I can't find any typical 'wordpress' way of using wordpress' XML exporter (that it uses to export xml for posts and custom post types etc) to specifically export an XML structure custom post types ...
0
votes
1answer
45 views

Undefined $post in wp_query

I have a custom post type called resources. On it's post template, I have a widget which will display posts which have the same tags, i.e. If I'm on an article post, the widget will show other ...
1
vote
1answer
29 views

CPT Archive with core Category

I have a custom post type of news_archive and they are using WordPress Categories. I would like to get some archive pages for these categories with only the CPTs and not core Posts. I managed to come ...
0
votes
1answer
33 views

Get posts from Custom Taxonomy

I've registered a new post type called Resources. Within the theme root, I've created archive-resources.php which looks like this: <?php /** * Template Name: Resources */ get_header(); ...
0
votes
0answers
18 views

Why is a CPT's meta for 'Allow Comments' false in Gutenberg?

So I've just spent hours trying to figure out why my call to comment_form() inside a theme was not rendering at all. This was a custom post type that supports comments yet nothing rendered. I ...
1
vote
1answer
40 views

WordPress nl2br is not converting newline to html line break when saving metabox value

I tried possible solutions to save \n as <br /> from my custom post type <textarea> metabox but it is not working. I am using a custom made theme and there is no additional plugin ...
0
votes
0answers
35 views

How to get current post type?

I want to get the current post type inside functions.php This is a function to sort reviews by custom meta key. I've managed to get the reviews sorted using the following code: // Sort reviews in ...
-1
votes
2answers
24 views

how to show Author post type count

I have multi author wordpress site and every author can publish posts from two different post types . i want to display author post count by post type in author.php . According to codex.wordpress i ...
0
votes
1answer
17 views

post body class for current user only if they are the post author

I'm trying to find a way to add a body class "author" IF the current user is the author of the post they are viewing. This is what I have so far... add_filter( 'body_class','my_body_classes' ); ...
0
votes
1answer
20 views

Get queried object for custom post type count

$posts = get_queried_object(); echo $posts->count; I can get post count with this code in taxonomy archive page . problem is that i can not specify post type. i just want count only A custom post ...
0
votes
0answers
18 views

CPT post count is 0 for the authors in the User list

I have created few CPTs for my website. There are several guest writers for my blog. The posts that the authors write are CPTs. However, the post count beside the user list is still 0. I want to ...
0
votes
1answer
89 views

Change custom post type slugs, with category/taxonomy before post type name

I'm currently working on a website which is a collective name of 2 schools. That's why I've renamed the taxonomy categories to schools. So in every post of a custom post type I can select the right ...
0
votes
1answer
13 views

How to convert Post Object Custom Field into Tags

so I've used this script in from this post to automatically convert an existing custom field into a tag. The problem is that my custom field is a Post Object. SO, it is creating a tag with the post ID....
0
votes
1answer
49 views

Rename a slug label

In my custom post type there is a custom taxonomy that has the usual Title, Slug and Description fields. I'm expecting the end user to not understand what the slug is for, and in my case it needs to ...
1
vote
1answer
31 views

Taxonomies don't show up on in the dashboard page for a custom post type in wordpress 5.22

In wordpress 5.22 , After creating a custom post type like: function create_products_cpt(){ register_post_type( 'product', array( 'labels' => $labels, 'public' =...
1
vote
0answers
39 views

Taxonomies are not showing in the category dropdown

I am working on clients website and I have added the Custom post type plugin for creating the new section and I have also added the taxonomies for that. In my page, I have added the default ...
1
vote
0answers
27 views

Assign same parrent Page to pages AND custom post types

I have a page, where I list our current free job positions, let's call it Career. In it's content all custom post types of type job_position are being displayed. For some specific reasons I need to ...
0
votes
0answers
23 views

Order custom post type search result order using custom fields

Here is my scenario: It's a real state theme based on wordpress. There is a "properties" custom post type. Buy page Includes a form, where user selects type of property, country and city (these are ...
1
vote
1answer
33 views

Remove post type slug of all post types from permalinks

I know similar questions were asked before, but this is new account and I can't comment there. This code remove post type slug from permalink. But I have a lot of post type. How can use this code for ...
0
votes
1answer
16 views

localize_script or rest api

If the data is available in both options, in what use cases should i use the localize script to make data available to my javascript code, and in what cases should i use the rest_api? I have a custom ...
1
vote
2answers
33 views

Custom Taxonomy Not Showing Up on Post Page

I have a custom post type with a custom taxonomy that has been working fine for years, but recently I've seen that the custom taxonomy doesn't show up in the individual custom post type anymore. ...
0
votes
1answer
41 views

Add Pagination in custom Blog page template

I am using custom page for blogs(page-allblogs.php). I have not written all the code in this page because i wanted write clean codes. So this page has following codes: <?php get_header();?> &...
0
votes
0answers
42 views

How to use POST method using custom wordpress button?

everyone! I'm pretty new to wordpress development, and right now i'm trying develop a small ecommerce site using some wordpress plugins and some php on my part. Right now i'm in the middle of ...
0
votes
1answer
27 views

Post Attribute Section missing for Custom post type

This is how I created the custom post type function wp_custom_post_type_listing() { $labels = array( 'name' => _x('Listing', 'post type general name', 'wpprolister'), ...
0
votes
0answers
25 views

get_the_terms child terms for current post/custom post only

Inside a Post / Custom Post type loop, I am trying to get child terms selected on the edit screen of that post/custom post. For Example: Zoologist ( Parent ) Pre Zoologist Post Zoologist Now if ...
0
votes
0answers
60 views

Problems in paginate_links with custom query loop and MB-Relationships

Im having some troubles with paginate_links. Im using the plugin MB-Relationships, and 2 custom-post-types: Artist and Artworks. On the single-artist I need to do a Query to show all the artworks ...
0
votes
1answer
25 views

Trigger WP CRON from a date in a Custom Field?

I have Custom Post Types which have a vanilla 'date-picker' for each post. My Custom Posts are actually events that are always in the future. I'd like to know if I can somehow trigger an alert when ...
0
votes
1answer
83 views

remove post-name from title in custom post type

I simply want two custom post type meta propertys to be the identifiers for the URL. I implements a solution but it just 404's registering post type: final private static function ...
1
vote
1answer
67 views

Custom template won't load for a custom post type (custom permalinks used)

I created a custom taxonomy for my custom post types. function create_states_hierarchical_taxonomy() { $labels = array( 'name' => _x( 'States', 'taxonomy general name' ), 'singular_name' ...
0
votes
1answer
25 views

Custom post type archive with page as parent url

I have a custom post type called articoli-redazione. I would like to make archive url of this kind of post type to have a PAGE as parent as in this example: https://mywebsite.it/page-name/custom-...
0
votes
0answers
20 views

custom post type url rewrited redirecting to home page

So I'm in the position where I thought I had setup my custom post types custom url correctly (it should be in the format domain.com/malta-property/locationofproperty/referencenumber). I don't want the ...
0
votes
0answers
13 views

Front end form, save as custom post and email to users

I want to create a form in my theme that saves a custom post ('type' is 'letter') and then mails it to users from a query (for example users that have a custom key 'user_sub_newsletter' with value '...
2
votes
1answer
42 views

associate custom post type with tags with specific pages

I have various products (custom post type) which already have categories but I have now I have added this line to be able to add tags to the products. 'taxonomies' => array('post_tag') So, I ...
0
votes
1answer
18 views

display the posts of Custom Post type in custom category

I create custom post type named "project". and the custom taxonomy of project is named "project_cat". so my question is that if I create an "apple" taxonomy,and the URL will be http://localhost/...
0
votes
0answers
46 views

Is it possible to link an external stylesheet, exclusively within a specific single post template?

SOLUTION Big shoutout to the wonderful SallyM, who answered this very succinctly in the comments of this post. If it helps anybody, here's the code that I used. Note: Replace the //CONTENT// with ...
0
votes
0answers
17 views

Why do my custom post type show up in all pages?

I was doing a page with template-parts to call my custom post type but the posts are popping up across the top of the site, I think it's because of the query , when I deleted it they stop popping up ...
0
votes
1answer
42 views

Shortcode and get_template_part

I'm developing my own plugin for my wordpress. I create a shortcode for my plugin and CPT with a custom taxonomy and custom single-CPT. When I try to use the function get_template_part() in my ...
0
votes
0answers
19 views

Custom post types imported from another wordpress site, not showing on frontend unless I go in and reupdate them

I have duplicated a wordpress site, using the same theme and exported and imported same content. In the Wordpress admin everything seems there in the new site after the import, but when I go to pages ...