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
0 answers
71 views

WP_Query get posts in custom database table [duplicate]

I have a custom database table like this: How can I get the 5 posts of custom post type whose ID appears most times? Thank you!
0 votes
0 answers
16 views

How to save template data into wp_post table (post_content column)

Is there a way to save template data into wp_post table? I made a custom template that automatically makes tables and some sentences with the meta-data that users insert in. I wanted to make users ...
0 votes
1 answer
93 views

How to Get Posts, Including Private Ones?

Currently in one of my php files, I retrieve all of the public posts like this: $posts = get_posts(array( 'posts_per_page' => -1, 'post_type' => 'post' )); However, this only returns ...
0 votes
1 answer
199 views

Getting featured image with PHP and not javascript from wordpress api _embed [closed]

Not having access to the functions file, I can't add the function to add the featured image to the API so I need to use wp-json/wp/v2/posts?_embed. With javascript I believe it is ._embedded['wp:...
0 votes
2 answers
82 views

Is there a way to add the list of recent posts into the admin sub menu on hover?

If I need to edit a specific post then I need to click the "All Posts" link and then find it. It would be nice to click directly on a link from within the popup hover sub menu. Something ...
0 votes
0 answers
62 views

Bulk update published posts date randomly using wp-cli?

I see an option ([--post_date=<post_date>]) in wp-cli, but how can we use wp-cli to update all my published posts date randomly? For example, I want all posts date changed randomly between 01-01-...
  • 11
0 votes
1 answer
39 views

Is there a way to make [Table Of Content] plugin while not using revision data?

I have a problem while using TOC plugins 'cause all of TOC plugins use revision data to recognize header tag. I'm using my own metadata (custum field) plugin and the data doens't show on the revision ...
0 votes
0 answers
80 views

Adding /blog in front of single posts (only)

I would like to add /blog in front of the url for a single post: e.g. website.com/blog/news-article -> single article website.com/blog -> blog archive (showing a list of all blogs etc.) Ive ...
1 vote
1 answer
26 views

Getting category posts from a certain year

Is there a way to get category posts from a certain year? I know how to get all posts posted in a certain year -> www.example.com/**year**/ or with months -> wwx.example.com/year/month (that's ...
  • 11
0 votes
0 answers
52 views

WP query taxonomy optimization

Is there any way to speed this query? Noob here. SELECT wp_posts.ID FROM wp_posts LEFT JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) WHERE 1=1 AND (...
0 votes
0 answers
55 views

Creating posts with links from a txt file

I have a script which scrapes articles from the web and saves the url to a .txt file. I've created a custom plugin which on activation, loops through the urls and creates a draft post with the content ...
0 votes
1 answer
32 views

Add static text to post URLs

I have 2 pages on my site which include blog posts (real site is pw protected): https://example.com/blog/ https://example.com/news/ All blog and news articles should have a URL that begins with https:/...
0 votes
1 answer
51 views

ACF to select posts not displaying on blog page

I am trying to implement a repeater / post object so I can select posts that I want to displaying on the sidebar. I am using this code: <?php while ( have_rows('top_posts_repeater')) : the_row(); /...
1 vote
0 answers
26 views

Choose whether to automatically add a taxonomy with the same name as the post

I created a custom taxonomy within the blog post. It's called "FootNotes." I would like there to be a checkmark inside in the creation of the post that asks me "Are there any notes ...
0 votes
1 answer
55 views

Get all comments of author's posts

Hello I have multi author website. I want to display all comments of posts created by author in author page. Please help me. I found this code but fatal error <?php $args = array( '...
0 votes
0 answers
101 views

redirect after submiting post for review

I have a frontend page that allows "Tutor Instructor" role, to create a course and this course is a custom type post called courses, when the Tutor Instructor finishes creating the course he ...
  • 15
0 votes
0 answers
25 views

Display a specific category in a focused area of my site

I've been trying to change the code of my WordPress site. Rather than showing "trending posts" which is determined by post_views_count, I simply want to show posts from a certain category. ...
  • 1
0 votes
1 answer
176 views

How to disable edit post option? [closed]

I have a WordPress LMS site, and the Tutor Instructor role can create posts as courses and these posts are custom post types called courses, and I want to disallow the Tutor Instructor to edit their ...
  • 15
0 votes
0 answers
20 views

Post in bulk based on category template

Let's start with an example of what I want to do. take a look at hardreset.info / devicesfaq.com as you can see, the articles are almost the same, they only change few keywords / or based on title (...
0 votes
0 answers
39 views

Pagination at category doesnt work with same name of page

i have a problem with my pagination but only at category page. I'am not developer, and i try fix it from few days. My pagination working if i make different name of pages for main BLOG, and category ...
0 votes
1 answer
42 views

can't modify post title using the_posts filter

I tried to modify post title and content, content is modified in output, but title stays intact: function filter_the_posts( $array , $oQuery) { ... $array[0]->post_title='new title'; $...
0 votes
1 answer
28 views

Prevent posts with certain post_meta to be edited

So I am looking at adding some custom post_meta to posts and I want those posts to not be editable, which will be some content that I am pulling in. Here is what I have: I have solved the issues when ...
  • 3
1 vote
1 answer
86 views

Exclude post_meta from Rest API Endpoint

So I know that I can call: $response = wp_remote_get( 'https://www.example.com/wp-json/wp/v2/posts' ); To get all the posts from a specific website using the Rest API Endpoint. I also know that ...
  • 25
0 votes
0 answers
117 views

Add posts to custom table in database instead of wp_posts

What the code does: Imports posts, loops through all the posts and calls wp_insert_post to create a new posts for each import. Objective: Import posts and store them in another table, not under the ...
  • 199
1 vote
1 answer
133 views

Exclude posts w/ specific post_meta on Rest API endpoint

So WordPress offers the default Rest API endpoint, which is: https://example.com/wp-json/wp/v2/posts which pulls in all the posts. Is there a way to configure and modify the existing /wp/v2/posts ...
  • 11
0 votes
0 answers
124 views

WordPress Rest API - Get all posts based on post_meta on custom endpoint

So I can't seem to figure out how to get ALL posts based on a specific post meta, so I wanted to reach out and see if someone might be able to assist. What I am trying to achieve: I have website A, ...
  • 199
0 votes
1 answer
40 views

Admin slow on Postlist (over 30k Posts in Database)

we have a Site with around 20k Posts in the normal postlist and another 10k in other CPT. The custom post types work really fast, but the normal Post List doesn't. I assume that might be because the ...
0 votes
0 answers
13 views

How to prevent to create same url of post, if the previous was deleted?

Let's say I'm creating a post, it's URL will be: www.example.com/posts/test-article so far so good. Then, I delete it and also remove from trash bin. Again, I create with the same title, and the URL ...
0 votes
0 answers
101 views

Delete Post but retain image of post [WP REST API]

Currently, when I delete a post in my wordpress website, the image is deleted automatically. Which is fine for most cases, however, there are certain posts where I don't want to delete the image from ...
0 votes
0 answers
31 views

Pull in posts using post meta for REST API

So I wasn't able to find much detail about this, so I wanted to ask the community to see if I can get an answer. So let's say that I have the following: $this->global_endpoint = 'https://example....
  • 1
0 votes
0 answers
6 views

Mailing list submission from a post that doesn't have a form on it

I've received a mailing list submission from a blog post page on my WP site which doesn't currently show any forms. Any ideas how this could have happened? When I log in to the WP admin, go to Forms, ...
  • 101
0 votes
1 answer
47 views

How Do I Redirect Wordpress Pages but not posts?

I have a client that changed jobs. He wants to redirect all pages on the wordpress site to a specific page on that site. But he also wants to keep all the SEO from the blog posts. So I need all the ...
0 votes
1 answer
101 views

Automatically add images to a menu

I am calling a menu into a page, but I want to add images next to the title of the menu items. I have this code: <ol> <?php $navMenu = wp_get_nav_menu_items(2096); /*/Pass Nav Menu_id or ...
  • 167
0 votes
0 answers
11 views

Show Last Revision Of Post That Has A Published Status On Single Page

I used this code to make a custom post status which is public so that the post is still available for people to view. // Define new awaiting status function my_custom_post_status(){ ...
  • 145
1 vote
0 answers
31 views

Block Editor: Reset Reusable Blocks to last saved record

I’m trying to build my own Block Editor and I would like to reset all blocks to their last saved state by dismissing all unsaved changes when switching from Edit Mode to Preview Mode without reloading ...
  • 11
0 votes
1 answer
229 views

Override WordPress core post-template.php block template

I need to modify the default markup generated using the render_block_core_post_template function located inside wp-includes > blocks > post-template.php. I don't see any other way of modifying ...
0 votes
0 answers
82 views

How to select a category automatically based on a word in WordPress post title?

I am working with an auto-posting blog where the articles come through RSS Feed. There are lots of posts publishing every day automatically. Now I need to get a category automatically based on a word ...
0 votes
1 answer
49 views

using is_paged for hiding image on posts

In my posts I'm using <!--nextpage--> in order to paginate specific blog posts, which works fine. But my issue is that the featured image shows in the post header for each page. I've tried using ...
  • 113
0 votes
1 answer
41 views

Only show featured image on first page of paginated posts

I'm experimenting with paginated posts on my site using the SmartMag theme, and I've customized my post content template quite a bit. However, I still have one issue I'd like to fix: On paginated ...
  • 113
0 votes
1 answer
17 views

Create a custom posts page

I've created a template that shows all my blog posts. But the issue was that this page slug (tips-and-tricks) wasn't added to the URL of the single post. Solution: I've selected this page as my blog ...
  • 135
0 votes
1 answer
29 views

Why am I getting a different filename? And how does WordPress load singular.php for both Page & Post? (Fresh WordPress installation)

I installed latest XAMPP & extracted latest WordPress to this path: C:\xampp\htdocs I activated default theme: Active: Twenty Twenty I created these: 1 Page called test: http://localhost:82/...
0 votes
0 answers
10 views

How to remove the ManageBlocksMenuItem in the ToolsMoreMenuGroup in the Gutenberg Editor?

In the Edit Article page of the Gutenberg Editor, click the three buttons on the far right side of the Gutenberg menu bar. You get an overlay with VIEW, EDITOR, PLUGINS, and TOOLS sections. Block ...
  • 1
0 votes
1 answer
199 views

Why is a wp function used in current PHP namespace's callback not resolved to global scope?

Imagine the following script: <?php namespace MySpace; class MyClass { public static function execute() { // Do something post_exists(1,'','','my_post_type'); } } ?> I'm now ...
  • 421
0 votes
1 answer
403 views

Exclude some categories from listing on the current post

this should be simple, but it seems it is not. I simply want to not list some of the current post's categories, just exclude them from the list of categories the current post belongs to I use this for ...
  • 167
0 votes
0 answers
90 views

get value from get_post_meta then reuse it in another get_post_meta

I am writing the following code, which I have updated since the original question so as to give the entire picture. I am a newbie, and the reason why I am not using the get_posts() function in ...
0 votes
0 answers
23 views

Wordpress - When visiting a `single post/ single.php` my category menu item link becomes active

I'm new to WordPress. So, I'm not really sure if it's normal behavior or not but this is bothering me. So, I've my main navigation menu consists of Home | category_1 | Category_2 | Category_3 ... The ...
  • 101
-1 votes
1 answer
18 views

How do you order posts by type then term_id and then by date?

I am a php newbie and struggling to try and figure this one out. I have page where I am returning all the newsroom posts. The posts have a newsroom type that further divides them into Awards, Press ...
  • 1
0 votes
2 answers
28 views

Different background colors for posts with Wordpress

I have a question. Right now I displayed my posts in the next way: Title and under it a short description of that post(everything centered and the post is looking like a card). My client wants each ...
0 votes
1 answer
20 views

Get other posts sharing the same meta values

I want to get all posts having the same meta values. My Post A has 2 meta values: ID 182 and ID 183 I want to have all post having meta 182 or 183, excepting the current one of course. I have tried: $...
1 vote
0 answers
103 views

WP Remote Request not returning all of content via request

EDIT: I think I discovered the issue, the endpoint is truncating the content response, does anyone know how to send over all of the data without it being truncated? So I stumbled across some ...
  • 21