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.

0
votes
1answer
28 views

Add content to wordpress edit.php page

I want to add some content, in the top or bottom of the wordpress edit.php page for a custom post type. What is the right filter or way to do this ?
2
votes
3answers
76 views

WP_Query with custom post_type and cat retrieving unwanted posts with the custom posts

I have a custom post type "projets" that is using the category taxonomy (so it is sharing categories with regular posts). When I call WP_Query like this: $args = array( 'post_type' => '...
0
votes
1answer
23 views

Classic editor showing in Gutenberg when creating a custom post type

I'm building a theme using Gutenberg for the first time. In the past, I've built custom post types like this: // Register Custom Post Type function custom_post_type() { $labels = array( '...
0
votes
1answer
18 views

Show Recently Viewed Custom Post to the visitor without plugin

I need to Show Recently Viewed Custom Posts to the visitor without plugin because my design is different. Can anyone advice me how to achieve this functionality. I'll do it. Thanks
0
votes
1answer
34 views

How to display Related Posts based on number of taxonomy terms matched

I have a custom post-type 'News' which has multiple custom taxonomies 'news-category', 'news-tags'. Each post contains between 4-8 'news-tags' and 1 'news-category'. For my current post, I'd like to ...
0
votes
1answer
31 views

posts_per_page is not working by term

I'm trying to limit the posts, but it does not work. It shows them all. Why posts_per_page does not work here? <?php // Output all Taxonomies names with their respective items $terms = get_terms( ...
0
votes
0answers
17 views

Custom post thumbnail image not working anymore

This page shows thumbnails for custom posts, but it's not working with new posts: http://jmldesigndev.com/swss-02/about-us/meet-our-providers/ Here's the code that pulls the thumbnail, but I don't ...
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: ...
0
votes
1answer
29 views

Too many revision when post status is changes [duplicate]

When ever i update the custom post type it generates too many revision which crashed the website. ( memory exceeded) How can i debug this issue? Update : I was able to find the culprit. Will it be ...
0
votes
1answer
36 views

Multiple Custom Post Type queries, how to DRY it up

I need to be able to display the latest post from 4 different custom post types and then use those posts inside a carousel. Everything is working fine but I'm not happy with how my code looks as I'm ...
0
votes
0answers
32 views

WP Query to order posts with a specific meta value first

I am trying to write a WP post query to get all posts which have a certain meta key, but with those which have the key set to a specific value to show first. The query modifications are in a ...
0
votes
1answer
17 views

Search result based on URL

Currently I am using bellow function to display search results from Custom Post Type. add_filter( 'pre_get_posts', 'tgm_io_cpt_search' ); function tgm_io_cpt_search( $query ) { if ( $query->...
0
votes
0answers
40 views

Gutenberg: Sidebar for specific post type

I'm trying to figure out a way, to create a Gutenberg sidebar that is only visible on a custom post type. For instance, I'd like my sidebar with settings, like a custom checkbox, only related to ...
0
votes
0answers
16 views

Help with a cron job query on WordPress CTP

I have got a custom post type called reminders. It has the following meta boxes. description specific date It is allocated to a specific user I would like to know how to go about creating a cron ...
0
votes
0answers
11 views

How to display only those posts as related post which have same post object?

I have two custom post types Lectures and Chapters. I have made a custom field in lectures post type and set the field type post object. In chapters post type I have added Chapter 1: Biology Fsc ...
0
votes
1answer
11 views

How to order multiple custom post types with same taxonomy by date

I am using this code to display list of multiple custom posts by same taxonomy and order them by date publishing. But somehow it mixed the order. The live example: https://planetaudio.hr/novo-u-...
1
vote
1answer
29 views

Including metaboxes from custom post types in global search — continued

I've seen several questions about including the content of meta-fields in a wordpress search. My question is not a duplicate of these. Background The issue I'm having stems from how meta queries ...
1
vote
1answer
36 views

List Post Title by Last Word Then Second Last

I have a CPT - Author where the title of the post is used as Author's name. I'm trying to list the authors alphabetically based on the last word (last name) and it works best. Here is the code in ...
0
votes
1answer
36 views

Custom post type not showing in search result

I have a custom post type that I would like to be searchable (I use the relevanssi search plugin). I have the following code to add the custom post type: add_action('init', 'eyewebz_create_post_types'...
0
votes
1answer
10 views

delete_published_posts does not work

I made a plugin with a custom post type calls "product". For some reasons, the administrator cannot move to trash post inside the list table. I know the capability to do that is ...
0
votes
1answer
26 views

Filter Custom Post Type Posts by Taxonomy

I created a custom post type named "listas" and a custom taxonomy named "taxolistas". I would like to fix this function from the plugin Thumbs Rating to make it filter posts by custom taxonomies ...
0
votes
1answer
28 views

Using The REST API How To Pull All Custom Posts?

What I am trying to do is pull back all posts of a custom post type. I know with the WordPress REST API you can add per_page=100 to the end of the REST API to pull back 100 posts, but I need a way to ...
0
votes
1answer
30 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 . ...
0
votes
1answer
15 views

Displaying posts inside table having issues

I am trying to create a comparsion table like the attached image. But it was not working like in the image. for that i have done following code what i am getting is not like the image for example the ...
0
votes
0answers
22 views

Exporting CPT from dev site and import into live site?

Trying to figure out the best way of doing this with the WP CLI. Right now I'm running: wp export --dir=./tmp_posts/ --post__in=2656 --with_attachments This creates an export file, but some of the ...
1
vote
1answer
21 views

Listing posts under primary and secondary taxonomies

Following on from this post: List all posts in custom post type by taxonomy How would I go about doing the same as above with a Custom Post Type called Area, but looping through the child-categories ...
0
votes
0answers
45 views

Woocommerce: Update SKU after add to cart button

Some products have the standard SKU (inventory) field from woocommerce (SKU1) and an extra SKU (sku2) custom field. I added a mandatory selection box: "With barcode", "without barcode", if the user ...
0
votes
1answer
21 views

Post URL based on Custom Post Types variables

I would like to create custom post URL from Custom Post Types variable. I considered a way to do that: In Permalinks settings, I see there are some default tags you can choose to compound URL from (%...
1
vote
1answer
39 views

Custom post-type in root directory, blog posts in subdirectory

I have a website with one custom post type as well as a blog. For the custom post type I would like to have the slug as root, like so http://domain.com/<title> And the blog post I would like ...
0
votes
0answers
27 views

Staggering featured post using 'sticky'

So I have Custom post type that occasionally will have posts marked as 'featured' Client would like to use the 'sticky' feature of WordPress to pick which posts from the CPT are classed as featured ...
0
votes
1answer
36 views

the_content(); of custom post type treated as an array or object

I created a custom post type in the mu-plugins folder. function wpdocs_codex_book_init() { $labels = array( 'name' => _x( 'Books', 'Post type general name', '...
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', '...
0
votes
0answers
12 views

Specific Content of Custom Post to be Displayed in Custom URL

I created a custom post called 'mall-events'. I would like to display parts of its content on a separate template using a custom URL. Please help and bear with me, I'm noob. Thanks.
0
votes
1answer
22 views

Is it possible to use array_walk() to append terms to an array of posts?

I'm creating a masonry post grid of animals. I plan to filter the the visible posts by toggling classes. The classes would in turn would be the post's. I'm using an MVC theme and would like to get ...
0
votes
1answer
12 views

Custom Post Type Template Hierarchy - Single post template

I have registered a custom post type and I am trying to make posts of that type display in a specific template file but can't figure out what to name my template file in order for the posts to use it. ...
0
votes
0answers
28 views

How to have multiple the_content() tags

I am designing a wordpress blog where you click on the title of the post and the content of the post opens up from the right side of the website. I was wondering if it was possible to have multiple ...
0
votes
0answers
27 views

Grid slider with custom post type (how to filter with taxonomies?)

I managed to use Radiant Scroller to create a slider grid of posts for my custom post type (zee_work). It serves as a display of portfolio items in a very clean neat way, but I need to filter the ...
0
votes
3answers
56 views

WP_Query not resetting after wp_reset_postdata

I have this custom query: if (isset($_COOKIE['myCookie']) && $_COOKIE['myCookie'] == $f_r) { $args = array( 'posts_per_page' => 4, 'nopaging' => false, 'order' => ...
-1
votes
1answer
110 views

The editor has encountered an unexpected error. // TypeError: Cannot read property 'prefix' of null

when I tried to edit a post of a custom post type, I experienced this error. When I press "Copy Error" I am getting this: TypeError: Cannot read property 'prefix' of null at https://example.com/...
0
votes
1answer
25 views

Custom Post Type Advanced Slug

I've been searching for a little while now, and I'm not even sure if this is possible. I have a custom post type 'holidays', for the post, with a category taxonomy 'locations' to put the posts into. ...
0
votes
1answer
18 views

Add HTML before a specific div?

I bought the "Woocommere Checkout Add-Ons" Plugin, which adds upsells to the checkout page - but it only allows to place text after the upsell checkbox. So I got the idea to add an image with some ...
0
votes
0answers
20 views

Publish Two different post types

What I am asking is a bit of a stretch I am assuming. I have two different post types 'place' and 'events' and they are interlinked with each other. The events post type is required for displaying ...
0
votes
1answer
20 views

Group search results by post type, but hide post types with no results

I was looking for a clean way to group my search results by posttype. I currently have 3 post types: Page, Post and Glossary. After a long search this answer in this thread got me what I needed. The ...
0
votes
0answers
17 views

Get Previous Post based on Custom Field Name, for Custom Post Type

I am using this query but the results returned are based chronologically (from my understanding) for get_previous_post(). <?php $prevPost = get_previous_post(); if($prevPost) { ...
1
vote
1answer
41 views

Group posts by custom post type

I created a custom post type called Game, and created 3 posts under it, Game A, Game B and Game B. I also want to create more posts, like guides and tutorials, for Game A, is thre a way to group ...
0
votes
0answers
8 views

How users can add custom post type to their own bucket?

I would like any users connected have the possibility to add post to their own category. They can choose the name of this category. Default is bucket. Example : There a 3 posts. Each user can add ...
0
votes
0answers
14 views

Delete Custom Posts & Attachments

I'm trying to setup a script that will automatically delete all posts of a custom post type, including their attachments. The first part of the script seems to work fine: $allposts= get_posts( ...
0
votes
0answers
26 views

Custom post type showing index.php

I am creating a theme and I have created a new Custom Post Type (CPT) called 'Custom Plugins'. I am trying to get this CPT to use its own template. I have created a single-custom-plugin.php - it doesn'...
1
vote
1answer
19 views

redirect automatic page that serves custom posttype content

I registered blog as a custom post type. This content is queried on the page page-actueel-blog. But mydomain.com/blog also serves content (by default titles are queried). I don't want visitors to ...
0
votes
1answer
23 views

How to create editable sections in wordpress?

I am making a website for a friend and he doesn't know how to code so I decided to make him a WordPress website which is new to me. I wanna make a homepage that has different sections (About us ...