Skip to main content
The 2024 Developer Survey results are live! See the results

Questions tagged [custom-post-types]

Custom Post Types extend WordPress to support additional content.

Filter by
Sorted by
Tagged with
0 votes
1 answer
827 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 ...
0 votes
2 answers
801 views

Selecting posts older than the current Unix epoch timestamp

I am trying to perform the following query, which originates by the fact the post's 'date' and 'time' are entered as separate custom fields. $args = array( 'post_type' => 'some_kind_of_posts'...
1 vote
0 answers
10 views

Linking and embedding two custom post types with the REST API

Hope you are having a great day! I am developing a theme and in my functions.php, I have registered two custom post types—modules and sessions—like this: register_post_type( 'module', [ '...
1 vote
2 answers
2k views

Show custom post type inside a custom post type

I am kind'a new to wordpress and i need some help. I am building a website that contains articles. in each article page i want to show the writer details(image name and short description). I have ...
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
3 answers
3k 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
0 answers
6 views

Meta query sort order is lexigraphical instead of numeric

I'm working with lumber and have custom post types with ACF fields for height and width in decimals. I'm trying to sort my posts first by height and then by width. I am using the following code: // ...
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
1 answer
14 views

Custom post type removing /page/2/ from URL when trying to access it

I made a shortcode to list form entry data that paginates using paginate_links(). I added this shortcode to a regular page and it works fine. If I click on page 2, it refreshes the page and adds the /...
0 votes
1 answer
739 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
0 answers
14 views

How can i permanently remove all plugin tag/buttons from text editor Visual editor, [closed]

First there are several plugins that refuse to get off the text editor I tried everything. I have both text editor and tinyMCE plugin installed.
0 votes
0 answers
10 views

I am having a problem with fetching product data in the Gutenberg block editor

const allProducts = useSelect((select) => { return select('core').getEntityRecords('postType', 'product', { per_page: -1, _embed: true, }); }, [...
1 vote
1 answer
1k views

I am trying to hide a custom post type category to logged in users with Pre_Get_Posts

I have a custom post type in my theme called portfolio. It's categories are called project-categories. I am trying to exclude a project category for logged in users. I cannot get this to work at all. ...
1 vote
1 answer
2k views

Displaying posts exclusively in their category (not parent)

I am using a custom post type to add/display PDF documents (posts) on my website. taxonomy - wpl_documents_category post type - post_documents All is working well. However, I want to display the posts ...
0 votes
0 answers
15 views

Working with editors and pending custom post types

I have found a problem that I don't think WordPress is capable of handling I developed a CPT 'service-providers' and gave users capabilities to edit their own listing. Once they add a new listing or ...
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
2 answers
2k views

How to filter custom post data with AJAX?

I have build a custom post_type with "Resellers" in order to enter my personal reseller items. The "Resellers" post have taxonomies like "Countries" and "Departmens". I am running into a problem: ...
1 vote
1 answer
905 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( $...
3 votes
1 answer
971 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
1 answer
1k views

How to use posts as tabs in a custom page?

everyone. I'm a beginner at coding/Wordpress and need some help with a custom page I'm developing right now. The idea is simple: A list of items on the left An image with a description below on the ...
0 votes
1 answer
24 views

Creating subpages for each custom post type

I have a custom post type (created with ACF), called shops. Each shop has data for example about working hours, which are separated in each custom field (Monday, Tuesday, wednesday etc.). I have all ...
0 votes
1 answer
760 views

Custom Post Type Not Displaying Correctly

Okay, Where is teh custom post type directed to? is it single.php or page.php I have a page.php with a template part that displays each of my custom types but when i click on the item itself i just ...
1 vote
1 answer
1k views

List Taxonomy Terms based on another Taxonomy

I have a custom post type called Resources. Resources post type has two different taxonomies associated with it, Resource Types and Resource Tags. Resource Types sets the format/type of the resource ...
0 votes
1 answer
31 views

Remove `View post` Text

How to remove View post from this message ? My code is like below. public function game_updated_messages( $messages ) { $messages['game'] = $messages['post']; $messages['game'][...
0 votes
1 answer
875 views

Display 3 level taxonomies

I'm a bit confused how to handle this kind of output. I suppose to display three level taxonomies. When a term is clicked i still need to display his level brothers but also his children's... The ...
0 votes
1 answer
1k views

Get custom post type REST API not working

I want to load the content of a modal using the REST API of wordpress. I've added the show_in_rest param to the custom post type I've registered in my function file, but I'm unable to load it, I will ...
1 vote
3 answers
2k views

WP_Query to select custom post type with Advanced Custom Fields (ACF) date

1st post on this forum so sorry if not enough detail passed. I am trying to use WP_Query to gather CPT that have an Advanced Custom Field (WP Plugin) of "End Date", the field is a date ...
0 votes
0 answers
20 views

Redirect to All Custom post types

I am learning plugin development. How to redirect to All Custom post types page after insert a New Custom post type ?
0 votes
1 answer
687 views

Expire post to draft by date-picker custom field

Need to set post to draft when it reaches date from ACF date-picker field. This is code I'm using: // expire offer posts on date field. if (!wp_next_scheduled('expire_posts')){ wp_schedule_event(...
1 vote
1 answer
1k views

filter custom post in rest api with custom function

i have 3 custom post type : artists, songs, videos songs and videos have a meta that sort artist id of songs or videos filter in rest api couldn't return filtered post by artist id custom meta so i ...
0 votes
0 answers
13 views

Multiple search forms and respective results page templates?

I have a Woocommerce site and I would like to set up two different search forms, one for products and one for everything else (pages, posts, and a couple CPTs) that would render on it's own respective ...
0 votes
2 answers
828 views

Limit taxonomy terms added to a custom post type

I've created a Custom Post Type and a Custom Taxonomy. In WP Admin, how can I limit amount of taxonomy terms that are added to the custom post type? I want to add no more than one tag into the post. ...
0 votes
1 answer
1k views

Use page template instead of custom post type archive

I'm using a plugin that creates a projects custom post type called wm_projects. I configured my archive-wm_projects.php template to show the overview on /projects/ and my single page template, single-...
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() { $...
1 vote
1 answer
1k views

How do i search authors from search form using author's name

I am trying to use a search from authors, listings(i.e custom post type) products(i.e custom post type) I am able to search for custom post types but unable to do so for authors. I am using the ...
0 votes
2 answers
1k views

Create action running on trashed_post hook to modify post_meta value

I have a custom post type that always do math operation to its post_meta and other custom post type post_meta. For example: post-type 1 = cpt_product_order post-type 1 post_meta = ...
0 votes
0 answers
17 views

Remove date rewrite rule for custom post type archive page

I'm building a website with an archive page where I can filter posts by date (year and month) and by term. I'm using wordpress url params to display filtered posts. The filtered url looks like that : ...
0 votes
0 answers
16 views

Same Custom Post Type Slug and Custom Taxonomy Slug, with hierarchial unique permalink structure

I am new to wordpress custom post type and re-writing urls'. I have created a Custom Post Type with slug 'industry' further re-writen to 'industries' and Custom Taxonomy associated to it with same ...
1 vote
1 answer
3k views

How can I save a Custom Post Title and Slug with a Custom Field?

I'm using Advanced Custom Fields and I have Custom Post Type called 'recipe'. I'm using this below code to set the custom post title, based on a custom field called recipe_name: function ...
139 votes
17 answers
107k views

Adding a Taxonomy Filter to Admin List for a Custom Post Type?

I have created a Custom Post Type called 'listing' and added a Custom Taxonomy called 'businesses'. I would like to add a dropdown list of Businesses to the admin list for the Listings. Here is what ...
0 votes
1 answer
695 views

Display related CPT with custom taxonomy

I have two custom post types: "storefront_location" and "services" These are linked by a custom taxonomy "location" I am building a post template for "...
0 votes
1 answer
1k views

Add WordPress users to a custom post type

I have created a custom post type called Groups. I would like to provide an option to add Users to these groups in the Group edit page. Any help would be appreciated thank you. P.S: I thought of ...
0 votes
1 answer
1k views

Get a list of categories ids

I'm working on a portfolio with filters based on custom post type. That filters must display only categories for the posts that are displayed in the portfolio, since user can specify them by id in the ...
0 votes
1 answer
2k views

Issue on adding Icons to Custom Post Type

Can you please take a look at following code and let me know why i am not able to add icons to custom post type? add_action( 'admin_head', 'my_icons' ); function my_icons() {?> <style type="...
1 vote
3 answers
2k views

Displaying Custom Posts on a Page

I have created a page template and custom post type 'pa' that I want to display on the page template. I have the template created, also made archive-pa.php, single-pa.php My template: page-pa.php ...
0 votes
1 answer
2k views

Custom post type URL - filter by taxonomy

Created CPT = news uses default categories (IT and recruitment) I am struggling to view an archive of the posts based on their category mysite/news/ - shows all posts for that CPT whatever the ...
0 votes
1 answer
1k 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 ...
2 votes
2 answers
1k views

Adding Meta Boxes while Registering a Post Type in a Class

I am trying to add a few meta boxes for a Custom Post Type through a Class. I am using the "register_meta_box_cb" parameter while registering the Custom Post Type to specify the callback function for ...
0 votes
3 answers
2k views

Custom Post Type canonical link / pagination redirecting to root

I have inherited an existing site and have recently been asked to make some changes. They have 'renamed' the default post as 'latest-news' using this 'my_new_default_post_type': <?php add_action(...
0 votes
1 answer
2k 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 ...

1
2 3 4 5
208