Questions tagged [post-type]
The post-type tag has no usage guidance.
202
questions
0
votes
0
answers
16
views
WP_QUERY with both author and post_type set (makes me crazy)
If I do this
$args2 = array(
'post_type' => 'post',
);
$query2 = new WP_Query($args2);
error_log($query2->request);
Then I see this result
SELECT ...
0
votes
1
answer
22
views
How to make all post under post_type to draft or return a 404?
We have a client that wants to make all post under a certain post_type as draft or return a 404 display. If possible, I would like to do this programmatically instead of a plugin. Is this possible? I ...
0
votes
1
answer
501
views
Custom post type REST api 404: Updating failed. No route was found matching the URL and request method
I have registered a new post type as:
$this->sconfig= ['post_type'=> 'event', 'slug'=>'events'];
add_action('init', array($this, 'register_event_posttype'));
and
function ...
1
vote
0
answers
33
views
custom taxonomy not return in the code
i tried to add custom taxonomy to custom post type named "project".
this is my code:
function create_project_taxonomy() {
register_taxonomy(
'project_cat',
'...
0
votes
0
answers
19
views
Show a featured image with "Link" Post Type?
When I use a Post Format type of "link", no featured image shows up, just the URL on a blue background where I would expect the Featured Image to appear. A Post Format of "Video" ...
0
votes
0
answers
7
views
Quering array of post types & pagination. Articles are repeating sometimes on different pages
I am doing some page with filters and spotted interesting bug (is it a bug??) related to quering articles (posts).
In my case I want to output default “post” articles and my custom post type “blog”.
...
1
vote
1
answer
270
views
get_post_types - exclude multiple post types by name
I am trying to get an array of all the post types except for attachments and pages. I've been able to do this with one exclusion like this:
get_post_types(
array(
'name' => 'page',
...
0
votes
0
answers
27
views
Why is my custom post content only viewable when signed into Wordpress?
I've created a custom Post type called 'Data' to display content on a Wordpress site. The content works and is displayed if viewed when signed into Wordpress. Howevever, if you view the same URL when ...
0
votes
1
answer
52
views
Target only single product page
At first sorry for my bad English!
I try to hide #mceu_27-body and #wp-content-editor-tools on products page (editing mode) like on the pics for certains authors!
This work find :
add_action('...
0
votes
0
answers
26
views
How do I make the comment disappear after deleting from the database?
I can delete the comment from the database with this code, however when the page is loaded again the comment will still be there. I need to update again to disappear.
How do I resolve this?
...
0
votes
0
answers
30
views
Custom Post Type Single Page is not working
I wanted to know, why my single custom post type isn't working.
Everytime I wanted to open the single post type it automatically gets back to the homepage.
Please help!
Here is my code:
// Team im ...
0
votes
1
answer
61
views
Wordpress private post won't display to other admins
By default Wordpress private posts are visible to all admins right. But on this build for some reason private posts are only displaying (on the page) to the admin that created it. I'm perplexed. I ...
0
votes
1
answer
119
views
Unique IDs for Post Types and Taxonomies
Sometimes I have duplicate IDs between Post Types and Taxonomies, I know this happens because they are stored in different tables but I wish it was possible to have a unique ID for each thing in WP, ...
0
votes
1
answer
76
views
Only show meta on one post type on search results page
I want to remove the post meta from all post types that are not "posts" from my site or at least from the search results.
Im currently using the Jnews theme and in the search results page I ...
1
vote
0
answers
14
views
Adding sections in the 'Pages' post type
I'm wondering if there is a way to add titles or nested groups to the pages post type. A website of ours have an enormous amount of pages so we want to order the pages in (preferably) groups/...
4
votes
2
answers
765
views
How to get only posts, pages and custom post types in WordPress
I am trying to get Pages, Posts and Custom Post Types In WordPress website but it is showing some other things in the list.
My Code:
<?php $types = get_post_types( ['public' => true ], '...
0
votes
1
answer
49
views
How to loop custom post_type from (a) specific category(ies)?
I'm using this code which works really fine to list quite everything I need as Featured image and title, from my custom posts "portfolio".
<?php
$args = array(
'posts_per_page' ...
0
votes
1
answer
295
views
Local Post Date in Wordpress Admin Panel Tables
It seems that Wordpress does not save the post date in UnixTimeStamp in the database, and it comes up with the whole date and time format, as we can see in the image below.
With this introduction in ...
1
vote
1
answer
263
views
How to display get_post_type() translated?
In my content-search.php template file I did something like this:
<tr id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<td><?php the_post_thumbnail( '...
0
votes
1
answer
167
views
Remove taxonomies using register_post_type_args
The theme I'm using is adding taxonomies to CPT using register_post_type and 'taxonomies' => array('portfolio-cat') as one of the arguments.
I need to remove that particular taxonomy using ...
0
votes
1
answer
702
views
Custom post type and standard post not displaying or working
I want to display 5 images of custom post type 'project' and 1 standard post in the front-page. I have tried to merge both queries in one, however its not working.
FYI: I have set the theme support ...
0
votes
1
answer
60
views
post_type internal ID?
This may sound like a stupid question, but is there something like an ID associated with the post types (built in or custom) in WordPress?
I'm not interested in the actual post id, but wondering if ...
0
votes
1
answer
70
views
How to get all post status
I need to modify this code to show all post status, not just published. Any idea?
$post_types = get_post_types(array('public'=>true),'names');
$post_type = !empty($_REQUEST['type']) && ...
1
vote
0
answers
35
views
How do I set default meta value by post type?
I'm trying to set a meta variable depending on what custom post type is set but can't get my code to work. This is the function in the plugin that sets the metabox after the plugin has added it to ...
0
votes
2
answers
34
views
Get all post types that supports tags
I'm trying to get all the post types that has tags functionality. I searched a lot but couldn't find a conditional or something for that. I need a way to get post types or post objects for the posts ...
2
votes
0
answers
91
views
How can I filter block registration based on post-type? (Block alignment settings)
I want to disable the .alignwide and .alignfull block alignment options (remove them from the editor UI) on the 'post' post-type only.
I have tried using this block registration filter to modify the '...
0
votes
1
answer
111
views
Twillio How To Send SMS for Custom Post Type
Twillio has a tutorial where one assembles a plugin that sends SMS notices when 'post' is published. The issue I face is many 'post' types are published a day and that would generate an annoying ...
0
votes
1
answer
30
views
How can I get the content of the current page in my loop while merging post-type
I made a loop which is loading post-type.
But while it is loading basic post and post-type, it is not loading the main content of the page.
I am searching for a way to load the current page content ...
1
vote
0
answers
47
views
Limit amount of posts made within a custom taxonomy
Is there a way to limit the number of posts that can be created within a custom taxonomy?
I have a custom post type called Preferred Agents and a custom taxonomy called Agent Location. I want to be ...
0
votes
1
answer
306
views
Quick Draft widget (dashboard.php) using custom post_type
I'm trying to amend the WP dashboard widget 'Quick Draft' to accept a custom post_type avada_portfolio (Avada Fusion Theme) but the page just hangs each submission test.
There was a similar question ...
1
vote
0
answers
120
views
How to retrieve more posts from a custom post type that are in the same category as the current post
The site I'm working on is using a plugin IssueM that created a custom post type called article, and has a custom taxonomy called issuem_issue_categories that has categories such as boat-profile, ...
0
votes
0
answers
34
views
Shortcode is not showing content when placed in editor (post_type = page)
I have created a shortcode, which I want to use in pages. When I place this shortcode in a page (post_type = 'page'), it does now display the content. But if I place the same shortcode in a post (...
1
vote
0
answers
43
views
force permalink slug for page vs post_type slug parent
I have setup permalink for post_type "directory" with this slug domain.com/directory/company-name
now when I try create page with domain.com/directory is detect as parent of post_type "directory" ...
0
votes
1
answer
27
views
Custom query for certain post type OR another post type with a certain category
I want to display posts that are either
EITHER Post Type A
OR Post Type B but ONLY if they are also in CATEGORY 1
Is that at all posible? How do I built my custom query?
-1
votes
1
answer
61
views
How can I get the first post THIS SAME CATEGORY?
How can I get the first post THIS SAME CATEGORY? It's just that now he takes the very first post that is generally in this type, but it is necessary that he takes the first post in the same category ...
1
vote
0
answers
20
views
Incorrect post_type in url of taxonomy term
I have registered a custom post type oa_location with custom menu (using show_in_menu) and a taxonomy called oa_country. These two connected but because our CPT placed in a custom menu, there is a ...
0
votes
1
answer
56
views
Distinguish between page and post in function
I'm trying to apply some text to the "Featured Image" box. It works fine for a custom post type, but I can't get a specific piece of text appearing on pages rather than posts.
add_filter( '...
0
votes
1
answer
61
views
custom post type single page not found after aotumatic publish By the author's robot
I use a plugin that has a custom post type and when I publish a post it is displayed on a single page but when the post is automatically published using a author's robot plugin, unfortunately the ...
4
votes
4
answers
4k
views
Disable block from editor based on post type
I've made a Gutenberg block which is only appropriate to show on hierarchical post types, so I want to disable it from the block inserter for non-hierarchical post types.
I thought about how to ...
0
votes
0
answers
16
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.
...
1
vote
1
answer
220
views
How to restrict wordpress search to pages and disable products listing search?
I have a requirement where i need to restrict wordpress search to pages listing only and disable products listing . In other words i wanted to replace post type in the search url from 'products' to '...
0
votes
1
answer
249
views
How to add post type in masonry posts elementory widget
When I try to create a website using Wordpress 5.2.2. I found a widget called Masonry Posts in Elementor Panel. But when I added the widget and checked there is no option to choose the post type. We ...
0
votes
1
answer
47
views
Filter by Post Type
I'm trying to figure out how to filter the posts returned by post type. I have a list of checkboxes of my different post types, and using that, I've gotten an array of the post types wanted;
$...
0
votes
1
answer
441
views
How to get all CPT names into WP_Query 'post_type' parameter?
hello
I want to display post based on his ID. This post could be a default 'post', 'page' or other registered custom post type. In query I sould specify all CPT names which I want to use, for eg.
'...
0
votes
1
answer
213
views
Custom slugs for Each Tab
I have a website for musicians information. The information is divided to few different subjects, using tabs - 'General', 'Songs', 'Albums' and 'Videos.
<?php if($tab_story){?>
<li role="...
0
votes
1
answer
314
views
Custom post type single with custom URL structure
I have a function that rewrites the URL before post slug including a custom taxonomy
function wpa_show_permalinks( $post_link, $post ){
if ( is_object( $post ) && $post->post_type == '...
0
votes
2
answers
27
views
multible shortcodes (for differnt values) with one function
I am trying to create a function whicht has different shortcodes as output. I have the post-type => womos and the field => personenzahl. The field has the values 1 up to 7. Now I need a shortcode for ...
0
votes
0
answers
25
views
Permalink like example.com/taxonomy/post_type/postname
I would like permalink structures like this:
example.com/%post_tag%/post_type/postname for posts
example.com/%post_tag%/post_type for archive page of post_tag filtered with custom post type archive
...
1
vote
1
answer
227
views
View the number of entries recorded per day
I want to display a chart of the number of articles published from a post_type within a specified time period (e.g. 30 days).
Example :
1/1/2019 (1)
1/2/2019 (15)
1/3/2019 (0)
1/4/2019 (6)
1/5/2019 (0)...
0
votes
1
answer
12k
views
get_the_post_thumbnail_url('full') returns empty from custom post type
I'm trying to display the full size image of the single post from a custom post type that I created, below is what I've tried
<?php
$args = array(
'post_type' => 'press',
'order' ...