Questions tagged [posts]

Posts are the core of WordPress. They store content, are categorized, and are expansible with meta. Posts are grouped by post type, and within their post type by taxonomy (though a taxonomy can span more than one post type).

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

Updating post status via rest api

I am attempting to remove/hide a post via the REST API and having issues. Currently, I have tried sending the payload as: { 'status':'private' } And I send the request to: /wp/v2/posts/<id ...
0
votes
2answers
23 views

Display latest posts from a specific categories

I am trying to get latest from specific categories (3 posts), but the code does not seem working. Instead of displaying posts from the mentioned categories, it is displaying posts from the first ...
0
votes
2answers
28 views

Add get_the_tags() to Single Posts <head> section via functions.php

How to print Posts tags in single posts head section from function.php. <meta property="article:tag" content="Single Posts Tags" />
2
votes
2answers
40 views

Make `previous_post_link()` Function Show The Post After Next i.e. Jump A Post

Is it possible when using the previous_post_link() function to make it get the previous post after next i.e. make it skip a post. So if you're on post 5 in numerical order it skips to post 3? The ...
1
vote
0answers
24 views

Add custom post type settings to wordress default posts

When I create custom post types in wordpress I got the following site structure which works perfectly with Permalinks "/%category%/%postname%/": Preview and category page: [main]/animals/ [...
0
votes
1answer
12 views

Hook when post is set from published to draft?

Is there an action i can hook into when a post is set from published back to draft? I have tried both transition_post_status and publish_to_draft but they don't seem to work when I set the post back ...
3
votes
3answers
86 views

Pull Two Posts Into Custom Post Type `single-cpt.php`

I have a custom post type and in the CPT's single-cpt.php file I would like to pull in two posts instead of one. The two posts will be the post the user clicked in the relevant archive, and the next ...
1
vote
0answers
30 views

Assign category to new post via URL

There are two post categories in my WordPress site, Blog category and News category. I want to create two links in admin dashboard, each of the links will open post-new.php but a different category ...
0
votes
3answers
23 views

Execute php after post save/update

I have created a php script (generate.php) which is querying posts on set criteria and then writing result in custom xml file. I would like to execute the generate.php everytime the post Save/Update ...
2
votes
1answer
13 views

Adding variable for post title so post template can include auto-generated link to view on external website.com/{post title}

There's an external website that I'll be referencing within my posts that uses the same static format for their pages. Let's say it's website.com/view/1111, website.com/view/1112, etc. What I want to ...
0
votes
0answers
24 views

How to disable single page for specific posts?

I need to disable single pages for specific posts, but only after specific condition. My code is here: add_shortcode('list-posts-basic', 'ant_post_listing_shortcode'); function ...
0
votes
0answers
25 views

Get specific post in MODAL popup

I need to load posts in modal popup dynamically. I have found many solutions but upon trying nothing works for me. The solutions do not load the modal popup at all. I tried getting the ID from the ...
0
votes
0answers
11 views

Check post exists by post_name not post_title

Is it possible to check if a posts exists using the post_name (not the post_title)? I'm aware of post_exists() but that uses the title not the name. I'm also aware of doing the following but this ...
0
votes
1answer
19 views

Blog page error 'Index of /blog'

A friend has reached out to me for help and thus far I have been unable to figure out what the problem is - his (outdated no longer supported) theme is not displaying his blog - when you click on the ...
0
votes
0answers
19 views

Limit front-end submitted posts by role

Right, I know this question has been asked, but, none have provided me with a workable solution, hoping someone can help. I created a property listing site using the plugin Essential Real Estate. The ...
0
votes
0answers
13 views

How can i enter common data in each post with custom fields?

I have WordPress blog. that have common content in each post. I want to create custom post type and custom field for any media that can have the same data and just I will write each time different ...
0
votes
0answers
9 views

No blocks available when adding a new post

In add a new entry. I have no blocks. What is going on?
1
vote
1answer
22 views

Uppercase first sentence in every post

Brand new to this community but been tinkering with WordPress for years. I would like to edit my website's functions.php file to be able to automatically do a task I have to do manually each day. ...
0
votes
0answers
30 views

Query on a repeater date (acf)

I'm struggling with this. I a have list of date (not fixed, I can have as many date as I want) made thanks to the ACF Repeater. In my query, I want to filter by date. But, I have to hide some post if ...
0
votes
0answers
77 views

Publishing failed. The response is not a valid JSON response

I am using wordpress 5.4.2. I get this error when trying to add a new post. I changed my permalink to Post name sample http://localhost/wordpress/sample-post/ How should i change my .htaccess My ...
0
votes
2answers
26 views

Send email to user when I publish a new post

i want to send email only new post publish in wordpress admin when i pulish anything its sending mail to user how to restric this to only new post added to send mail to user function ...
0
votes
1answer
30 views

How to add one time a new page?

I m working on a plugin and i would add a page for every value of my database. But for every refresh, a new page with same name will be added. How can i fix this? for ($i = 0; $i < count($namepages)...
0
votes
1answer
15 views

add all blog posts to folder

I want to add all the blog posts to the /blogs/the-post-name type structure. I can do this through the permalinks settings with: /blogs/%postname%/ but this also affects custom post types resulting ...
0
votes
0answers
11 views

Unable to save or update posts with Emoji

I host my WordPress (v5.4.2) blog on 000webhost.com and I am unable to save any post with emoji characters. I get this error Updating failed. Could not update post in the database I have tried ...
0
votes
1answer
22 views

Setting posts_per_page for taxonomy term template

I have a custom taxonomy term page set up to display posts associated with that term (taxonomy-insight_type-academia.php). I figured I could use the following to limit the posts on that page based on ...
0
votes
1answer
41 views

Adding an option to post editor to show a site disclaimer or message

I was wondering how I would go about adding an option to add a site disclaimer or message for a published post in Word Press. Something like this (Please See Below) Which by checking the box will ...
0
votes
0answers
22 views

How to write this wordpress code

The idea here is to share bulk WordPress posts between multisite blogs automatically. I have googled some tutorials and I know I can use save_post action hook, switch_to_blog and get_post() + ...
0
votes
1answer
25 views

How many post WordPress can handle?

I am maintaining a multiuser blog site in wordpress cms. I got 30/40 post per day, its mean around 10k post at the end of year. Every post contains a featured image at around 140kb file size. The site ...
0
votes
1answer
25 views

Query custom post type custom meta key

I want to get all post with the value X looking in the meta_key field. After tha I want to loop trough all post and get the title. I got this so far. function get_events( ) { $recurrence_ids = ...
0
votes
0answers
7 views

Filters post by subcategory slug using buttons

I load in subpage post with one category now i try filter this post by him subcategory and get link to page some like mypage.com/subpage/?slug=fish after click button and see only fish post. I should ...
0
votes
0answers
33 views

Time Stamp In A Wordpress Post Title That Does Not Keep Refreshing

I have a short-code that uses PHP to echo a time stamp ala: 1595140137 When I use that short-code as the default post title in new post, the post title changes with each page refresh, and in the ...
0
votes
0answers
26 views

Sort by date Function ? post date randomizer wordpress

function pdr_randomize() { $randomize = isset( $_REQUEST['randomize'] ) ? $_REQUEST['randomize'] : ''; if ( isset( $_GET['pdr_rd_nonce'] ) && wp_verify_nonce( $_GET['pdr_rd_nonce'], '...
0
votes
1answer
32 views

How do I find the count of the current post?

Let's say my custom post type is 'story'. I've got 20 stories published on my site. So each post becomes: 'story 1', 'story 2', ... 'story 20'. Thus, first post is 'story 1', and last post is 'story ...
0
votes
2answers
16 views

How to get post titles by post ID and integrate with my code?

I have function which gets menu next and previous item url. I want to get also title for them. How can I do this? This is what i have : <?php $menu_name = 'main-menu'; $locations = ...
0
votes
1answer
11 views

How to pull sticky post permalink inside php?

So, I have the following code written inside my function.php. I use it on my blog post to display the sticky post, but my only issue is I'm not sure how to get the permalink inside my HTML. Also, how ...
0
votes
1answer
17 views

Disable posts generated from image uploads

WordPress generates a post for each image I upload. On my site I got a picture assigned to the header: https://autowaschplatz.at/contact/. The image is separately browsable via https://autowaschplatz....
0
votes
1answer
17 views

Check $post->ID against multiple values

i have the following snippet on the site which is working perfectly fine but sometimes I have multiple pages where I want to trigger the event snippet from google, my questions can I add multiple ids ...
0
votes
1answer
21 views

First x post with another template then the others

I want to output the 5 latest posts. But the template of the first 2 must be different than the other 3 posts. So I've created two queries. The first one shows the 2 posts: <?php $loop = new ...
0
votes
0answers
16 views

WP_Query show the posts in sequence of tags entered in Query

Basicly I want to show the post in sequence of what the tags entered are. For instance this is my Query: $args = array( 'post_type' => array( 'providers' ), 'post_status' ...
0
votes
1answer
29 views

How to show only homepage in google results instead of privacy, contact pages

When I search my website in google, all the pages and posts can see. I want to make only homepage visible in search results and remove other pages(privacy, contact etc). And also all the posts can ...
0
votes
0answers
16 views

How to create multiple posts with embedded images?

Here's the problem I want a quick way to create multiple blog posts with embedded images My current process goes like this Create post -> Create block -> Insert image link -> Remove header -&...
0
votes
1answer
27 views

Display/Filter post using if else statement

Here it is: I want to filter my post based on category (Party) If the post with category Party has tag which is 'event', it is the one that will display If there is no ''event' tag, only the recent ...
0
votes
1answer
33 views

How to sort WP_Post Object array by object field in php?

I have a php code as shown below in which I want to sort WP_Post Object array by object field post_date. if ( $search ) { $area_query = new \WP_Query( [ 's' => $search, ...
0
votes
2answers
24 views

Assign custom class to post content images

Is possible to assign a default class to the images that are part of a post content? I have a problem with teh layout, this because the attached images insetred inside a post will break my bootstrap ...
2
votes
2answers
46 views

Importing New Posts from Live Site into Local Dev Site

I'm currently developing an updated version of a live site in a local environment. It's a very large site and the local dev site is using a entirely new theme without many of the live site's plugins ...
0
votes
0answers
21 views

Go back to the exact post page number

I use pagination in my index.php and I have many posts per page. Every post have a button to go back to home. The problem is that when I visit a post in a page 5 for example, the button always send me ...
0
votes
0answers
64 views

Limiting the Number of User Posts to Their Own Posts

I have set users to only see their own posts. But the total number of articles is still visible. Can we limit it to its own number of articles? How can it be done without plugins? related picture here:...
1
vote
0answers
24 views

Automatically create child pages and grandchild pages when saving a (parent) page

I have a bit of a tricky one... I have a hierarchical Custom Post Type ('shows') that represents events. Is it possible for the user to create a new page (ie show), save the page and for Wordpress to ...
0
votes
1answer
40 views

How to add automatically bootstrap 4 order-lg-1 and order-lg-2 classes for columns in foreach loop based on the count?

How to add automatically bootstrap 4 order-lg-1 and order-lg-2 classes for columns in foreach loop based on the count? PHP and Html Code <?php //get your custom posts ids as an array $...
1
vote
1answer
24 views

Add icon/badge next to posttitle of specific category

I would like to place an icon in the post title of every article from the category "plus". This is my attempt for function.php, but it doesn't work that way. Can someone please give me some ...