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
1 answer
221 views

What is the proper use of guid for images in wp_posts?

I understand that guid is a unique reference for a post, whether that post is a post or an attachment. When it's a post, I think guid is self-evident. But what is the correct formulation/destination ...
Robert Andrews's user avatar
0 votes
1 answer
81 views

How to get post ID after removing that post?

Is it possible to get WordPress post ID after removing that post? I have found out that I need that ID to remove the page from the site map, but I do not have the post ID, becuase I have deleted it. ...
Albert's user avatar
  • 1
0 votes
0 answers
25 views

Post pages are redirecting to the 404 page in wordpress

In my root folder, I have installed WordPress. Now I have created a resources folder in the root and installed WordPress in that too. I am able to login into the resources admin panel and created ...
user9437856's user avatar
0 votes
0 answers
27 views

How to delete posts with incorrect status

This is a weird one. By mistake, I created some posts using WP Webhooks + Make where the post_status was incorrectly set to "published" instead of "publish". Now, for some reason ...
Chaoscontrol's user avatar
0 votes
2 answers
252 views

WP_Query post_tilte search in posts table

Here is my array which I am trying to get "apple" keyword in post table but it can't work like I want. Please let me know what is wrong with my array? Array ( [paged] => 1 [...
Vipul Jethva's user avatar
1 vote
2 answers
112 views

How to use a conditional statement in a post loop but not count towards the "posts_per_page" if false

I have a WP_Query which has the "posts_per_page" parameter set to 12. I am then using a while loop to iterate over all of the posts and an IF statement to check whether a condition is true ...
Sam's user avatar
  • 11
0 votes
1 answer
171 views

Count the number of matching post names in foreach loop

I have a simple foreach loop that outputs an ordered list from a CPT 'post_subscribers' and an associated meta key called 'project'. $theposts = get_posts( array( 'post_type' => '...
dekkyd's user avatar
  • 5
0 votes
0 answers
15 views

How can I customize sections of the homepage layout?

I would like to customize sections of my site layout based on categories, what could be a quick fix? I show you an example site that inspires me:
Alessandro Bosco's user avatar
0 votes
1 answer
21 views

Change post-name when inserting new Post if Specific Category is selected in WP

I want to hook a function for first time when new post is being inserted in WP. when Poetry category is selected I want to change post-name with random 7 numeric numbers like /poetry/2837410/ which ...
Ghost's user avatar
  • 43
0 votes
0 answers
71 views

How to remove category and other tags from posts page

On my website I have a primary menu. Under this menu, I have links for categories. When a user clicks these menu links, they're redirected to a landing page with all posts that are marked for that ...
Pitmaster's user avatar
0 votes
0 answers
23 views

I have a website issue I am trying to resolve

My website is jthomascrowne.com titled "The View From Here". I am currently using the Twenty Seventeen Theme on a Wordpress Business plan. I am relatively new to this. I know nothing about ...
j thomas crowne's user avatar
0 votes
1 answer
127 views

How to use shortcode to get the second to newest post?

I've done considerable research, and tried multiple solutions to my task, and currently have found a way but i know it is not the best, so hoping for input to do this better. The task I am using ...
Ben Blue's user avatar
  • 117
0 votes
1 answer
34 views

How to remove slug from CPT correctly?

Im trying to remove slug from my Custom Post Types. I've added 'rewrite' => array( 'slug' => '/' ) and based on this post https://wordpress.stackexchange.com/a/144356/116847 I've added: ...
D_P's user avatar
  • 143
0 votes
1 answer
73 views

Restore posts, but only posts that exist in my database backup

This is my situation. On 1 Jan 2023 I took a backup on my entire Wordpress database. Let's say that backup contains 100 posts. Fast forward to today, 14 Feb, and I now have say 125 posts in my ...
Matt's user avatar
  • 163
0 votes
0 answers
12 views

Batch Scanning and Deleting Empty WordPress Posts

I found a solution, How To Delete Post's With Empty Content Using WP-CLI. I am Looking For a SQL Query Version That Will Delete All Post's Eith Empty Content. Here Is the WP-CLI Version- wp post ...
damagebrain's user avatar
0 votes
1 answer
147 views

Need Help With Making Full-Width Template for Blog Posts (common methods aren't working)

I've been researching this one for a while and can't seem to find the solution. But, I'd like to have a selectable template that I can use for certain blog posts to make them full-width by not ...
LK.'s user avatar
  • 3
0 votes
0 answers
170 views

Download button under all images WordPress

I have a WordPress site with a huge number of images and I want to add the ability to download each one. they are contained in posts (one post contains 50-100 images). I tried using the "Files ...
Tsarevich's user avatar
0 votes
0 answers
19 views

Getting 400 Error in wordpress website

When I go to my blog page and click on one of the topics from the table of contents. Note the table of contents is made by using a plug in that takes all the element and make the toc. https://www....
Hassaan Ayaz's user avatar
4 votes
1 answer
323 views

Get related posts matching most of the provided tags using WP_Query

I need help in getting related posts using multiple tags. I have posts with the tags poetry, motivational, attitude, rules, lines, sigma and inspirations. I want related posts matching most of these ...
Ghost's user avatar
  • 43
0 votes
2 answers
343 views

How to sort posts alphabetically based on a specific parent category

I'm building out an index page of posts that are grouped under multiple categories, but those categories are all under the same umbrella parent category. I'd like to have these posts displayed ...
jzn110's user avatar
  • 1
5 votes
1 answer
197 views

Disable "Quick edit" for roles in WP dashboard

How can you disable the "quick edit" link in posts in WP dashboard for roles with following conditions: The "Delete" ability shall stay the "View" post ability shall ...
vallespir's user avatar
0 votes
2 answers
249 views

website images getting corrupt automatically

I have just migrated my website from hostinger to hostinger manually. And now when I upload any picture on my website the photos getting corrupted automatically. Although the picture was shown on my ...
GULSHAN's user avatar
2 votes
0 answers
25 views

users followin the blog post author

I have a code which is supposed to follow the author of blog post but whenever the follow button is typed it gets an critical error on the wordpress. heres the script <?php // Get current user $...
heyyou's user avatar
  • 21
0 votes
0 answers
14 views

Redirect a specific User role not admins automatically to view the post that they just updated

Can someone please provide a code snippet where a specific user role will be redirected automatically to view the post that they update but don't redirect if they publish?
Rahul Hingonekar's user avatar
0 votes
0 answers
111 views

How to export post tags from wordpress

We want to export WordPress tags, there is no such feature in the default of WordPress wp-admin/export.php. How can we export? Are there any plugins for this?
Navid's user avatar
  • 1
0 votes
0 answers
147 views

Two pagination in one page without AJAX

So in this scenario, I'm trying to have a two pagination in one page, I have succedded doing that, in this specific page, I'm trying to display my custom post type and post at the same time in ...
agent abstract's user avatar
0 votes
0 answers
45 views

How can I merge a several related posts into one post?

I'm working on a site whose navigational structure needs to be flattened (it's been migrated from Joomla). I want to merge four or five levels of navigation into one post, and I need to do this many ...
small-media-large's user avatar
1 vote
0 answers
235 views

WordPress Ajax load doesn't work

Hello I have set up custom Ajax load more without plugins, but it’s only showing 3 posts on home page, and when clicking on button to load more it’s not loading anything. As I am a beginner I am ...
Ferdal Karaman's user avatar
0 votes
0 answers
77 views

transition_post_status hook, works - but not if the post is new

I have no idea whats going wrong. My transition_post_status function works if the post is saved as a draft or another status first, then saved again as the 'transferring' custom post status, which it ...
Yasmine Finbow's user avatar
0 votes
0 answers
7 views

my website didn't show the defult right sidebars

I am using Divi theme and added right sidebar. Some days before i changed the host and after that seems the right sidebar has gone. When i did re-update again the post the right sidebars has come . ...
Raghwendra Ojha's user avatar
0 votes
1 answer
58 views

Admin notice on wp_insert_post

I am trying to display some error messages in case some conditions are not met when using wp_insert_post. However, it the admin_notice doesn't seem to trigger. Here's the example I have: ...
dvm node's user avatar
0 votes
0 answers
29 views

Notify/check if the content of a custom gutenberg block has changed on save_post

I developed a custom gutenberg block that has some information saved in its attributes. I would like to know if there is a possibility to notify/check only if there is any change in the content of ...
Renan Bessa's user avatar
1 vote
1 answer
59 views

Filters do not work when there are multiple (one works)

I have this functions code: function my_query($query) { if (is_post_type_archive('mycustomposttype')) { $orderby = sanitize_text_field(get_query_var('orderby')); $orderby2 = ...
Johan's user avatar
  • 309
2 votes
2 answers
381 views

Is there a way to change the default post template selection for a specific category?

When we add the new post,the default template is selected. I want to change the default selected template to my custom template automatically before publishing or saving the post. Here's an example: ...
pardhan's user avatar
  • 21
0 votes
1 answer
84 views

Displaying all images from a WordPress post (including media library)

With this function, I'm getting only those images that I uploaded using the upload button in the post section. But, if I add an image from the media library in a post, it's not showing. I want to show ...
Sayed Newaz's user avatar
0 votes
1 answer
146 views

How to add paraent in Blog post URL in wordpress

I have a post in WordPress with having URL like https://digital.co/testpost I want to change the URL to something like https://digital.co/blogs/testpost How can I do that in a simple WordPress blog ...
Mehran Ali's user avatar
0 votes
1 answer
30 views

WordPress shows a count of published items on the site, but the items are not appearing when you click on the "published" link

WordPress shows a count of published items on the site, but the items are not appearing when you click on the "published" link. It's showing 39 published posts but when I click on published ...
tek bhatt's user avatar
0 votes
0 answers
32 views

Exclude posts by date - related post

I'm trying to exclude articles if are older than 2 years, related articles by category, but it just doesn't work. <?php $args = array('date_query' => array('post_date_gmt', 'before' =>...
unopermanente's user avatar
0 votes
0 answers
4 views

Inserting Media on New Post But Hides Previous Uploads for Editor/Contributor

We have a community website where people upload media. However, We wanted to restrict them to upload and attach previously uploaded media so that the previously uploaded media on different post are ...
user14772091's user avatar
0 votes
1 answer
84 views

How to change Post title background size?

I'm using a theme called "Blockst" from DeoThemes. On each Post title, I have an incredibly large title background. Unfortunately, I have no idea why or how it became so large. Unfortunately,...
Eric F's user avatar
  • 3
0 votes
0 answers
37 views

How do I get a function to work in single.php

I have a code. add_action( 'init', 'njengah_change_post_date_programmatically'); function njengah_change_post_date_programmatically(){ $time = current_time('mysql'); wp_update_post( array ( ...
Guruh's user avatar
  • 3
0 votes
0 answers
30 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
23 views

How can I fixe the article title problem?

Theme used:Zakra Site address : https://numadigit.com Hi, I have noticed for a few weeks that my sites under WordPress are misinterpreted for the SEO tag by Google. Indeed, in the title tags of the ...
Hermes Gédéon HOUNKANLIN's user avatar
-4 votes
1 answer
275 views

Undefined Function Fatal Error with Shortcode [closed]

I asked AI ChatGPT: Can you develop a wordpress shortcode to create a list of users of a certain role and for each one show if they commented on a certain post (counting how many comments they left)? ...
Simone Bionda's user avatar
0 votes
1 answer
44 views

Simple shortcode to check if a user has commented on a certain post

Hi all (mi first question on StackExchange, sorry in advance for my inability) I want to make a shortcode to check if the current user has commented on a specific post. I found this code as a starting ...
Simone Bionda's user avatar
0 votes
0 answers
18 views

Making a private post visitable by link?

I would like to know if it is possible to have a private post that can be visited by link. From what I understand, private posts can be only viewed by registered users, not guests. But I would like to ...
Jorens's user avatar
  • 1
0 votes
1 answer
32 views

Set post to draft if matching word is found in the post

Not sure what exactly I'm missing here but I'm trying to set a post to draft if one of the words are detected, it will only publish the post if the user removes the word found within the post. At the ...
Johan Barnard's user avatar
-1 votes
1 answer
28 views

Is there a plugin or another way that can help me find out the underlying files of a page/post? [closed]

I have a WordPress website, developed by someone else. I need to make some changes and fix some issues, as the site still has some flaws. For example, there are some fields that need to be changed, ...
Alika87's user avatar
0 votes
1 answer
33 views

Show some texts in posts belonging to Specific category

I am trying to add some text to the end of every post belonging to a specific category. I am using the following code - <div class="repair-tool"> <?php $catarray = ...
SK21's user avatar
  • 17
2 votes
0 answers
43 views

Is there a block to print post link standalone in a block theme?

I know we can print post property (e.g. title or date) wrapped into the link to the post by using a block with the attribute "isLink":true i.e. <!-- wp:post-title {"level":1, &...
stckvrw's user avatar
  • 285