Questions tagged [custom-post-types]
Custom Post Types extend WordPress to support additional content.
10,338
questions
0
votes
1
answer
15
views
Set custom post title to read only by user
I need custom post titles on the backend to be Read Only for all users except admin. This looks like it should be easy, but I'm stuck.
0
votes
1
answer
10
views
ACF - Tags not showing up in Custom Post Types
I have a tags taxonomy and then I've added it to my CPT, however it does not give me the option to add tags to my CPT now. How do I get it to do that?
1
vote
2
answers
21
views
Generate Post Title From ACF Fields on Custom Post Type
I have tried a few versions of the code to get this working and seem to come up with a couple of errors either way.
I am using ACF for the fields and adding the below code to the themes functions.php ...
1
vote
0
answers
16
views
Custom post type sub-category pagination return error 404 on second page
I have a custom query as follows:
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array(
'post_type' => 'programme',
'posts_per_page' =&...
1
vote
1
answer
16
views
How to add random prefix (based on related page slug) to custom post type?
I want to create some specific url structure for my website. My Pages will be Inner Home pages that will combine articles and reviews.
Articles and reviews are 2 separate custom post types.
I would ...
0
votes
1
answer
19
views
Hide load more button if no more post in selected category
I have built a ajax post loading program in wordpress where i load post depending on category and current post type.
ive got it all working except hiding the load more button if no more post.
ive been ...
0
votes
0
answers
10
views
Query by an array of values from an ACF repeater Post Object sub field
I am building a record label website in WordPress which has an artists and a releases post type.
I have a repeater field in releases called release_artist, containing a post object sub field called ...
0
votes
0
answers
13
views
Passing total post count to javascript
I have a ajax post loading program, I can load more post on click of a button.
Problem im having is getting the button to hide or show less when no more post.
I can query out the post count in PHP as ...
0
votes
1
answer
24
views
Pull total post count for child category and parent if term ID
I have a mess of code that works, however I know its a mess and im sure there is a neater way of doing this.
I am trying to get the child category to display under the parent category and for the post ...
0
votes
0
answers
36
views
Custom PHP Template in Twenty Twenty-Four
I am trying to use a custom php template in the latest theme and not only it has an file editor, there is no place for me to paste my template file.
This is a template file for a custom post type so I ...
0
votes
1
answer
14
views
get total post in category via ajx
Aim
The total to be equal to the amount of post within the selected category or sub category.
What im getting
I am getting 0 when trying to get the number of post available in a category.
My aim is to ...
1
vote
1
answer
24
views
Can't publish custom type posts that don't support title and editor, instead they're saved as draft
I’m developing a plugin that registers custom post types without support for title and editor. I’ve been working on this project for a couple of months now and when I began (WP version 6.3.1), it used ...
0
votes
0
answers
9
views
Trying to create wordpress pagination and breaking while live [duplicate]
I have been coding a pagination for my WordPress site, for a custom post query. and while it works just fine in my local machine it breaks online. I get a 404 when trying to click on page 2, while ...
1
vote
2
answers
25
views
add_post_meta unique value for all custom posts
I have a custom post type "Propietario" with several custom fields, and 3 of them: "dni", "email" and "phone" I need unique for all Propietario Post types. This ...
0
votes
1
answer
48
views
Custom post type pagination not working in index.php file
I have created a custom post type called news
Here is the code
function create_post_type_news() {
$supports = array(
'title', // post title
'editor', // post content
'author', // post author
'...
1
vote
1
answer
11
views
Display box in sidebar of custom post type
I have a plugin I've written that displays ratings on various pages on my site. It's shortcode based and just drops in on any given page
[mm-rating]
It draws from a field provided by the WP SSO ...
0
votes
1
answer
18
views
CPT without slug after domain mapping
I made a custom solution where two domains are mapped on single site, part of the pages are mapped to one domain and part to another. I used "Multidomain mapping on single site" plugin for ...
0
votes
1
answer
74
views
WP_Query for multiple post types just shows one
I have an issue, that I do not really understand. I hope, you can help me. I would like to have a WP_query for multiple post types:
$query = array(
'category_name' => $category,
'post_type' =&...
0
votes
1
answer
18
views
How to disable the single view / search /archive page for a already-built custom post type?
There is a plugin that adds a custom post type called "magicai-documents". I want to disable the single view, search, and archive pages (every area of frontend) for an already-built custom ...
0
votes
1
answer
14
views
Loop through categores and posts of a custom post type in WordPress?
I've created a custom post type called faq in WordPress and I've created a few categories for it - like "Billing" and "Shipping". My end goal is to create multiple FAQ "Posts&...
0
votes
0
answers
27
views
Hot to show custom post type taxonomies on archive page
I have a custom port type 'apartments' and each apartment has several parametres which I made into custom taxonomies, like 'number of rooms', 'area', 'region', 'status', etc.
The task is to show all ...
0
votes
0
answers
9
views
How to best assign choices to CPT posts and allow filtering on frontend
Looking for suggestions on how best to achieve my goals for assigning filters to posts and using those when searching for service providers.
I have created a CPT: Service Providers
I want to allow ...
1
vote
1
answer
12
views
Custom Post Type - archive working - single is not
So I'm really at my wits end here. I'm trying to get the single page working for my custom post type. I've done it several times now, but right now its just not working (404 - not found). I hope I ...
-1
votes
0
answers
9
views
How can I make a custom field in my Custom Post Type that will redirect the user to a different URL When clicking on post?
I'm looking to make a simple PHP scxript to help me redirect my "newsletter" custom post types to a URL without using a clunky redirect plugin. That way, I can easily display the articles ...
0
votes
0
answers
7
views
Integrate a Custom Post Type with Learndash Plugin
I've registered a custom post type already in wordpress. I am looking for a solution to display that custom post type in learndash course Hierarchy.
1
vote
2
answers
35
views
Сustom posts are displayed in the wrong menus
I have created two post types, but the problem is that both post types are shown in both menu menu of admin panel regardless of their type, and they are both shown in the standard posts menu.
I would ...
1
vote
0
answers
10
views
Frontend delete CPT post with custom role user
I am building a custom frontend where custom role members (created with User Role Editor) can add and edit spots.
"Spots" are a custom post type registered like this:
register_post_type('...
0
votes
0
answers
30
views
rest_api_init is not getting invoked inside a Class
When I include the code to expose custom post meta using the rest_api_init hook outside a specific class, it works perfectly, such as in the functions.php file. However, when I place the same code ...
0
votes
0
answers
4
views
child category under correct parent
I have a side bar that is showing my custom post type categories and sub categories, its build to show categories and the child if not present in the current custom post type as categories is used ...
0
votes
0
answers
23
views
Default post showing more than intended
I have a ajax set up where I am loading post categories via ajax request on click of a button.
I have a default query that is loaded for when the ajax filter is not set so a default state.
It should ...
1
vote
0
answers
40
views
Ajax load more post button not showing
I have some alpine.js and ajax that is loading wordpress posts on click of a button, this is working well.
however I am now trying to add some code to the button to hide if no post available to load, ...
1
vote
1
answer
11
views
How does WordPress manage to differentiate between post and page URLs without a distinct base, and how can I replicate this functionality?
I want clean URLs without a custom taxonomy name or custom post name.
The project and its structure are somewhat complex.
The customer wants certain strings from a third party plugin to be removed ...
0
votes
0
answers
12
views
Code output help please! WordPress> ACF > Relationship > Post Object
I am using ACF Relationship > Post Object on a custom post-type "family" to select another of the same post-type. My example usage is each post using this custom post-type = a person, the ...
0
votes
0
answers
12
views
Add block templates (html) via plugin for custom post type
I'm writing a plugin that provides a custom post type. I am currently trying to create the block templates for the "single" and the "archive" associated with the custom post type ...
0
votes
0
answers
19
views
Load more post with AJAX
I have a simple post that i am using alipine.js to help me load post using AJAX.
So far it is loading my pages and changing the category if I click a filter button, this is all expected and working.
...
0
votes
0
answers
15
views
Trying to create a custom post blog for an archive section at my wordpress website
I am working on a custom theme for WordPress and trying to create a new section in my dashboard to add custom posts for an archive. and is not working. It seems to be all fine.
This is my custom file, ...
1
vote
2
answers
73
views
Post current post type to my Ajax
I have two files, alpine js and a ajax, i want to get my current post type from wordpress with
$post_type = get_post_type( $post->ID );
$postType = get_queried_object();
$args = array(
'...
0
votes
0
answers
31
views
Get current post type within functions.php
In my function.php I need to run something to check post type or page id.
how can i check current post type loaded in functions.php
function.php
<?php
// the ajax function
add_action('...
0
votes
2
answers
40
views
Show category only if post type is post_three
How can i only show categories if post type is "post_three"
<aside class="sidebar">
<div class="widget widget-filter">
...
0
votes
0
answers
23
views
Taxonomy term archive claims there are no posts, but there are. How to resolve?
I have a custom post type (url), and a custom taxonomy term (url-category) for this post type.
The archive page for this custom post type works fine.
The taxonomy term archive claims there are no ...
0
votes
1
answer
19
views
Custom Field in Page Title
I need to show a custom Field in a title (CPT) I have this code
function wpse_224340_document_title($title){
global $post; // make sure the post object is available to us
if(is_singular('mec-...
0
votes
1
answer
57
views
Custom post type category pages pagination returns 404
I currently have the main posts archive page at /blog/ (custom permalink structure of /blog/%postname%/) and categories at /blog/category/ (categories base left empty so it defaults to this).
I have a ...
0
votes
0
answers
18
views
upload featured image using custom post type
I keep getting this error on specific posts that is created using custom post type.
the server is busy or does not have enough resources. Uploading a
smaller image may help. Suggested maximum size is ...
1
vote
1
answer
37
views
How to check if the post exists in any of the categories?
What I am doing is, I have to check if the post exists in any of the categories or not.
I have tried below two codes but it's not working for me.
This is the first code
foreach ($scats as $key => $...
1
vote
1
answer
12
views
Add a post when another post type is inserting
I want to add a product when service post type inserting or updating. Below is the code. It works but it keep generates products while the code executing. What is the wrong with this code?
add_action( ...
1
vote
2
answers
43
views
Rewrite taxonomy permalink appended to CPT archive url
I need the following url structures for my Custom Posttype and Custom Taxonomy. Can anyone please help in achieving them? Spent a lot of time but failed. Ton of thanks in advance.
Post URL: https://...
0
votes
0
answers
17
views
Should I save user cookie consent in a custom post type or make a custom database table?
What is the better solution for storing large number of user consents: saving them as entries of a custom post type or create custom database tables?
The consents will be remembered for half a year. ...
1
vote
2
answers
48
views
Search for portfolio tags & mixing portfoliotags and post tags
I have been trying to filter my search result without success.
Here is my function in functions.php
I want to retrieve only post and portfolio posts (no pages).
Below is the code I found on your ...
0
votes
1
answer
22
views
My site has only one page, and users access my uploaded mp3 files from there - can I analyze access by song title?
My site is Abracadenza.ca. I upload mp3 files to the media library. I then create ‘posts’ which display the songs on my home page. Each song is categorized using a number of categories, eg composer, ...
0
votes
2
answers
31
views
Subpage for Custom Post Type
I have a custom post type "location".
add_action("init", "register_custom_post_types");
function register_custom_post_types() {
register_post_type("location&...