Questions tagged [custom-post-types]

Custom Post Types extend WordPress to support additional content.

Filter by
Sorted by
Tagged with
0 votes
0 answers
15 views

Show a wordpress custom post condtionally using a category term

I created a custom post called sliders with a custom taxonomy slider_cat. It's for a restaurant and every Wednesday I want a specific post to show only on that day. Find my code attached: <?php $...
Tar Akiga's user avatar
0 votes
0 answers
19 views

How to use wp_set_object_terms depending on page ID?

The function to set custom term works fine. add_action( 'save_post', 'set_custom_term', 30, 2 ); function set_custom_term( $post_id, $post ) { wp_set_object_terms($post_id, 'guitar', 'instrument',...
Kim Caspe's user avatar
5 votes
1 answer
490 views

How to enable REST API on custom post type without Gutenberg?

I understand that you have to enable the REST API in order to use the Gutenberg block editor, because Gutenberg relies on it; however, I want to use the Classic Editor for a custom post type and still ...
Aristocles's user avatar
0 votes
1 answer
128 views

Custom post type with custom parent prefix slug

So for example, I have multiple custom post types movies, games, and music, I'd like to add a custom parent slug, so the output would be like this; or the custom post type slug should be the prefix ...
agent abstract's user avatar
0 votes
0 answers
10 views

Custom Taxonomy rewrite rule working for everything other than singles

I have been writing a custom rewrite for a CPT, its all working other than the cpt singles. Its really odd as the permalink is correct when you edit a post. However when you navigate to link it is not?...
Sam Sedgeman's user avatar
0 votes
0 answers
30 views

How to access the page without registering in wordpress

I have an issue with WordPress. I have the below code and I am getting into the admin menu: public function Create_Menu() { add_menu_page("demoset", "Demoset",...
Naren Verma's user avatar
0 votes
0 answers
149 views

Why isn't page attributes dropdown not showing up in a custom post type

After successfully creating a custom post type called events, I created a new template file to choose when creating event custom type page. But in the edit screen, there is no Page Attributes dropdown ...
CodeForGood's user avatar
0 votes
1 answer
94 views

get_post_types() is returning null

I am trying to retrieve the post types and put them into an array with their slug being the index and their label being the value. When I print_r( get_post_types() ); it returns the proper array with ...
JayDev95's user avatar
  • 157
1 vote
1 answer
31 views

Admin menu link with variable

I used this function to display a log out link below the home icon. But how could I put a variable, for instance the current username, on that link to show a profile page? The function is: ...
markseinto's user avatar
0 votes
1 answer
46 views

How to insert a post from a different post type after every nth post

The idea seems simple enough, insert a post from a different post type after every 3rd post in a wp_query. So should look something like this: Article 1 Article 2 Article 3 Ad 1 Article 4 Article 5 ...
ek2dx's user avatar
  • 1
0 votes
0 answers
53 views

Understanding capabilities parameter in register_post_type()

So far what I've understood: Capabilities parameter allows the plugin to set edit, read and delete capabilities for a certain post_type applicable to the all user roles. The primitive capabilities are ...
brittle_spirit's user avatar
0 votes
3 answers
174 views

Hide custom post type slug url from search engine [closed]

I want to hide, let's say, example.com/services/washing ('Services' is the this is a custom post type) from the search engine and show a 401 error page. How do I?
Warda's user avatar
  • 105
0 votes
0 answers
28 views

display posts, pages and custom post types from another wordpress site

I have 2 sites one acting as a parent and the second acting as a branch of the organization. The sites are on different domains and databases. I want to display on the branch site some posts and ...
Joxmar's user avatar
  • 103
0 votes
0 answers
30 views

Sort CPT by taxonomy AND THEN by custom field

I am trying to sort a CPT first by Taxonomy (tag) ASC and then by custom field (last_updated_hc) DESC which is a date-picker field. Using posts_orderby I can sort by taxonomy but I am running into ...
Whispar Design's user avatar
0 votes
0 answers
41 views

Internal Server Error when echoing an OBJECT from wp ajax action function in functions.php to JS file

I'm using Elementor Pro as my page builder. I'm trying to create a Job Post filter using Elementor forms. Issue is when I echo and return an Object type from the functions.php file to the JS file. It ...
shimii's user avatar
  • 15
0 votes
1 answer
70 views

How can I get values from a custom post type depending on where I click on my SVG map?

Here's what I would like to achieve (desktop only): https://www.icifaubourgboisbriand.com/en/stores/ When I click on my SVG map, I would like to display an information card for each store. I have ...
Valentin Grenier's user avatar
0 votes
0 answers
45 views

Display all child posts in a custom post type, grouped by a custom taxonomy site

I successfully use this code to Show Child posts on the Parent post page via shortcode: global $post; $args = array( 'post_parent' => $post->ID, 'posts_per_page' => -1, '...
Tom's user avatar
  • 1
0 votes
0 answers
70 views

Create WP multisites as a custom post type

I have a multisite network and have ACF site options on each subsite. The subsites are related eg some might be in the same area. I would like to add an ACF relationship field to each subsite where a ...
Kay's user avatar
  • 1
0 votes
0 answers
24 views

WP Query + custom fields: How to query event posts from the current date backwards 6 months and organize it month by month?

I am having some trouble figuring out the logic of this query and what I need to do to make it work. I created an "Event" custom post type, and every Event post has a date value coming from ...
Ramate's user avatar
  • 1
0 votes
0 answers
87 views

Custom post type disappeared in wordpress when I transferred theme to Showit

I'm working on a client website who had tons of custom blog post types. Once I changed the domain to direct to Showit theme, the custom blog posts are no longer editable or visible. Where did they go? ...
Tina's user avatar
  • 1
0 votes
0 answers
19 views

Same slug for Custom Taxonomy archive and CPT archive - Rewrite rule not working

I’m using a CPT (wg_seo_chat) together with a Custom taxonomy (wg_chat_category). Additional rewrite rules are in place to inject the Taxonomy into the URL: CPT archive: domain/hilfe-chat Taxonomy ...
locke85's user avatar
0 votes
1 answer
147 views

Wordpress WP_Query Sort by 2 dates - custom fields

I would like to build one big query that is sorted by 2 custom fields (type date). I have a query that needs to have 2 post types ['track_trip', 'training']. Those 2 types have ACF custom fields that ...
Masmiix's user avatar
1 vote
0 answers
103 views

Custom order of CPT posts by title, in wp-admin area by default

Its tough to know/determine/see if a plugin is ever overriding or will override my ability to use $query->set('orderby', 'title') when I am attempting to sort my admin posts by title, for my ...
klewis's user avatar
  • 835
0 votes
0 answers
29 views

Multiple custom post type in URL

I'm not sure how to handle this issue. We are developing an event website. So I've created of custom post type Event. Our customer can create x-number of events on their website. The URL of the event ...
Dennis's user avatar
  • 135
1 vote
0 answers
676 views

Custom Gutenberg block problem - This block has encountered an error and cannot be previewed

I have a problem with my Gutenberg custom block. Alone, it works perfectly on every page or post. But, when I want to add this block, which is set to be dynamic, to a custom post type, it says "...
Novica Vojinovic's user avatar
0 votes
1 answer
163 views

Show custom category archive as front page and remove taxonomy slug from urls

I have an art portfolio site in development. I have used CPT UI to set up: post type: works taxonomy: mediums mediums: paintings, etc The best way I could think to set this up was to use taxonomy-...
WP Shala's user avatar
0 votes
1 answer
54 views

Default Wordpress Query for a Specific Custom Post Type URL

I need a little more clarification on the default query for a specific custom post type url. I am learning how to use WP default functions and queries via Udemy. However, I feel like this little part ...
Rookie Recruits's user avatar
-1 votes
1 answer
27 views

Post object GUID adding http:/

In my template I have href="'.$package_link->guid.'" The resulting HTML is: href="http:/package/download-2023-friday-arrival-monday-departure-weekend-coach-festival-ticket/" Why ...
pee2pee's user avatar
  • 141
0 votes
0 answers
15 views

Custom post type Premalinks main page and details page

I have a custom post type "movie" with 'rewrite'=> array( 'slug' => 'movies') And I need the following : 1- site.com/movies/nameOfmovie ==> Main Movie page ==> this is working ...
Houssam Hsm's user avatar
0 votes
1 answer
354 views

Displaying custom meta box value in a custom post page

I have an issue with custom meta boxes in a custom made plugin. In fact, the task is simple, but I am new in this field. I made a plugin that allows user to enter the movie title in a custom meta box. ...
Novica Vojinovic's user avatar
0 votes
1 answer
34 views

Wrong block appender button showing

I noticed when creating a fresh site block appender button looks cleaner than my other site. This is a fresh site: This is my other site (big rectangle button): I disabled all plugins and switched ...
Justin Breen's user avatar
0 votes
0 answers
22 views

Comments not working (error not allowed) on posts with custom post status

I was able to make a custom post status using this codes: // Registering custom post status function wpb_custom_post_status(){ register_post_status('rejected', array( 'label' ...
CruzZ's user avatar
  • 11
0 votes
1 answer
25 views

How to initialise WP_Query on the basis of a specific meta_value and continue iterating rest?

I have a CPT with daily deals, I need to show these daily deals on my frontend as per today's day. For eg, if it is Thursday : The returning array should return Thursday, Friday, Saturday, Sunday, ...
Advait Nandeshwar's user avatar
-1 votes
1 answer
20 views

Select posts from list and add them in a new list

There is this fanduel website webpage with functionality to add players from left to selected players list in the right. Also when we click on filtering by position they are filtered without reloading ...
Broly LSSJ's user avatar
0 votes
1 answer
54 views

Custom archive URL as a subfolder of the custom post type slug

I have a Custom Post Type called Whatever. The slug for this CPT is whatever. By default, I can access the posts archive in the frontend at /whatever and each post at /whatever/post-slug But I would ...
Álvaro Franz's user avatar
0 votes
0 answers
249 views

Display all categories (with link) of custom post type - Wordpress

I have custom post type "case study". Inside it i have few categories. I want to display all existing categories from this "case study" CPT. I successfully listed items from CPT on ...
Tomasz W's user avatar
0 votes
0 answers
21 views

Trying to set up a range filter for related custom post types

I have set up two CPTs, "Property" and "Suite". Each Property has a number of Suites assigned to it via an ACF bidirectional relationship.  Each suite has a set size (in square ...
Jon Timms's user avatar
0 votes
1 answer
176 views

How to debug a 404 error on pages whose content is perfectly displayed when I explore it?

I have this issue I can't understand : recently (everything was working perfectly during years), some pages on my website are returning a 404 error while I can perfectly access to their content (even ...
PhpDoe's user avatar
  • 180
0 votes
1 answer
27 views

Custom post type, when type non existing post name, it query the nearest possible post name by default. How can I disabled this behavior

First, On a clean Wordpress installation using Local, I name the project "example" I install this Custom Post Type UI Plugin Then I Activate it. Then I have create a post type, suppose i ...
Sarawut Positwinyu's user avatar
0 votes
0 answers
18 views

CPT Archive Pagination - Page not found

I have the following code to register my CPT, related taxonomy and rewrite rules. $store_name = 'store' add_action('init', function () use ($store_name) { register_post_type( 'my_sample_cpt', ...
Anand's user avatar
  • 1
0 votes
1 answer
423 views

querying to custom field over ACF REST API

Iam using the "ACF" plugin with "ACF to REST API". I found a solution for querying a custom field over REST API. I inserted this into my functions.php: add_filter( 'rest_{type}...
fcb1900's user avatar
  • 101
0 votes
1 answer
59 views

How to print different informations for different post types inside The Loop?

I have a homepage that is mixing two post-types : post and events My aim is to print the details of each event in order to differentiate the content. This is the method that I used to mix posts and ...
Gadget's user avatar
  • 3
0 votes
0 answers
36 views

Fatal Error WordPress Custom Post Type UI + WPML

After updating the wp-core, wpml plugin the other language link stopped working, after this, we contacted the support, and tried to roll back everything, and nothing helps We noticed the conflict ...
Tanya Nami's user avatar
0 votes
0 answers
31 views

How to I add count of custom posts listed in a post as a prefix to its title

I run an affiliate site that consists primarily of posts that list product ideas (x products for purpose Z). Each post is a standard post with a custom field ID that is used to generate the list of ...
wordpresser's user avatar
0 votes
1 answer
111 views

How to dynamically register custom post type

I have this code in a custom plugin. public function create_new_cpt( WP_REST_Request $request ) { $args = $request->get_param('newCptDetails'); $cpt = register_post_type( ...
devdev's user avatar
  • 1
0 votes
0 answers
22 views

Create settings page to enable or disable CPT

I'm writing a plugin where I want to add a settings page to give the user the ability to enable or disable some custom post type and add some data into a custom db table the plugin will create at ...
devdev's user avatar
  • 1
0 votes
0 answers
57 views

From form submission values - dynamically update CPT "has_archive" slug and custom taxonomy "rewrite" slug value

I have defined a CPT and corresponding taxonomy like this - function my_custom_post_type() { register_post_type( 'my_sample_cpt', array( 'public' => true, 'has_archive' =...
Anand's user avatar
  • 1
0 votes
1 answer
101 views

Query order by meta value force specific tag first

I have a custom post type and a shortcode to display a slider. Below is the WP_query code for the shortcode. I'm trying to order a query by tag values. I want posts with a specific tag like for ...
Biels's user avatar
  • 113
0 votes
0 answers
20 views

How to add custom permalink struct with DYNAMIC author to a Custom Post Type

I created a CPT called column. I want to add a custom permalink struct ONLY to this CPT: /columnists/%author%/%postname% I need to pass the author CPT in the link, too. I already set the slug inside ...
alfredo's user avatar
  • 101
0 votes
0 answers
40 views

Filter custom post type returned from REST api

I'm creating a plugin and I have registered some custom post types. I'm getting them on a vue app using the rest api, I've also added some custom fields that are returned when the post types are ...
devdev's user avatar
  • 1

1
3 4
5
6 7
206