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
12 views

While loop through

$wp_query = new WP_Query([ 'post_type' => 'office', 'post_status' => 'any', 'posts_per_page' => -1, ]); $offices = []; if (count($wp_query->posts) > 0) { $offices = $...
0
votes
1answer
11 views

Wordpress get tags in “publish_post” hook

I want to get the selected tags using publish_post hook, while publishing the post. With below code, I can get only those tags which are already saved in the post. this will not work for new tags. ...
0
votes
0answers
13 views

Loop through an array and find the ID in another array

So I'm having some trouble with my looping and I would like to resolve it if possible. Below, I will go into detail on what I currently have: $test = strtoupper(str_replace(' ', '', trim($record->...
-2
votes
0answers
14 views

Wordpress wp_post table changes not affecting the page

I have a wordpress site. Recently I have changed the domain. In the wp admin page, I have changed corresponding areas which is related with domain name. Site works but the content created with the ...
0
votes
1answer
12 views

Show a text if the post has written by author user role in Wordpress

I search a PHP code what is show a certain text or html code on the post page when the post author is an author. (not admin or editor) When the post author is an admin or editor then show nothing. ...
0
votes
0answers
16 views

Adding empty cells in a table with posts

I'm trying to create a plugin, and want to show up a table, in which WP posts would be shown. I can do it with the following code: echo '<table class="custom_type_table">'; $custom_type_args = ...
0
votes
0answers
6 views

New Post Link Defaults to Standard Post, not Custom Post Type

I have a 'news' custom post type, but when I click the '+ New' link (image attached) in the backend it generates a new generic post, not a custom post type. How do I get the '+ New' link to relate ...
0
votes
1answer
20 views

How do I scope out why I have two “posts” menus in an admin?

A site I'm working on has an odd problem: two sets of "posts" menus in the admin. The client brought me on board and says "it's been there a while". How would I go about finding out why there are two ...
0
votes
1answer
11 views

How do we display a certain category type on a page while hiding all others?

We need to hide a specific category type on all pages but one, and then display that hidden category on a singular page. So far, to hide the category on all pages, we have coded this: // Exclude ...
0
votes
0answers
20 views

I want to get latest one post of a particular category

I want to get the latest one post on counting View Count. Latest I have tried this but didn't get the result : $popularpost = new WP_Query( array( 'post_type' => 'post', 'posts_per_page'...
0
votes
0answers
14 views

How to do a searchable database of links?

not sure how to go about something. There is a WP website I'm involved into, it's a scholarly database of thousands of links and for now those links are divided in couple of pdf docs which is not the ...
0
votes
0answers
13 views

SEARCH QUERIES - REVERSE OUTPUT

When I perform a search on the WP admin side for my custom post query I am returned with the most relevant queries first. Great However, performing the same search on the front end of the site and I ...
0
votes
1answer
22 views

wp_posts table extremely large

my posts table in my WordPress database is nearly 1GB in size despite only having 3,409 posts, which is vastly larger than other WordPress databases I have. None of the rows in the posts table seem to ...
0
votes
0answers
17 views

Display Specific Parent and Child Category Lists with Format

I have a code that I want to display in lists. <nav> <ul class="simplefilter filter-port"> <li class="btn active button btn-hover" data-filter="all">All</li> ...
0
votes
1answer
6 views

WordPress retrieving $post based on random key in $_POST

I have a WordPress page /floorplans/ that is submitting a form with the attributes method="post" and action="/contact/" to the '/contact/' page. Before I do anything else on the contact page, I am ...
2
votes
1answer
19 views

WordPress automatic and permanent page

When WordPress setup is complete, I want a page such as "localhost/contact" to occur automatically and make it permanent. In short, it cannot be edited and deleted in the panel. It should even be ...
0
votes
1answer
21 views

order custom post type posts by custom date

Trying to order posts by a custom field, where a date i stored. The date looks like this "03.10.2019". All of the below function works properly, but the posts are sorted by post date, not custom field ...
0
votes
0answers
7 views

Thumbnails and images in the blog post are not loading

I have a blog that has many images in it. Recently I encountered an issue that the images in the blog posts do not load if I refresh it after a while. This is the same with the thumbnail as well. What ...
0
votes
0answers
8 views

Make category required

I want to prevent a post from submitting if no category is chosen. I don't want them to be automatically in the default category but really force the user to choose a category. I found this question ...
0
votes
1answer
33 views

Import Instagram post to Wordpress blog post

I'm looking for a way how I can import an Instagram post to a Wordpress post. So to make it clear: I'm NOT looking for a Instagram Feed plugin. I need to import an Instagram post to a Wordpress blog ...
0
votes
0answers
13 views

Can I disable auto increment of WordPress Posts Database to utilize previously deleted records?

When I delete a record field of WordPress posts database such as Post, Image, Page, etc. and add new item then it will add in a fresh record field due to auto increment function. But I would like to ...
0
votes
2answers
18 views

Remove the URL author of post on all comments

I can't manage to disable the URL of only the author's post. Here's an example : My website As you can see, the green link is mine (the author of the post). I only want to remove that link, not other ...
0
votes
1answer
16 views

Navigate through the posts using keyboard arrows

I'm building my site on localhost and I'd like to navigate to next and previous posts by using keyboard right and left arrow keys. I know about the WP functions get_adjacent_post, get_next_post and ...
0
votes
0answers
20 views

wp_remote_get, how to update dynamically

please i want the ETHBTC price to be updating dynamically without refreshing the page,, if i use (meta http-equiv="refresh" content="5") it refresh the site. i want only the ETHBTC price to be ...
0
votes
1answer
13 views

Automatically delete post in a single category when a new one is created

Is it possible to delete/move to trash a post in a single category each time that a new post in the same category is created? I mean, I need to always keep just one post (the most recent) visible in ...
0
votes
1answer
10 views

Does having category name in permalinks affect SEO when having a post in multiple categories?

If I change the permalink structure to the following in the Permalinks settings page in WordPress: www.example.com/%category%/%postname%/ Then I create a post with the slug my-post and add two ...
0
votes
0answers
18 views

Is there a way to create a sidebar of bullets

On each individual post im trying to create a sidebar for my sources of information. is it possible to have a sidebar labeled sources with bullet points coming from it that im able to put links?
0
votes
1answer
17 views

How do I insert a custom post type query after a certain number of recent posts and then resume recent posts?

Example: 4 most recent regular posts 6 posts queried from custom post type 8 regular posts ( most recent posts with a 4 post offset so that it's a continuation of the first four posts on the page) ...
0
votes
0answers
7 views

Restricting post visibility to “members” only (alongside public/private/password posts)

I think I "get" the standard WP post visibility options... but they seem somewhat awkward to me: Public: post content is visible; post listed in lists; post is searchable Password protected: post ...
0
votes
1answer
12 views

restrict incrementation of post vies count when refreshing the page

I use a post views counter to save post views - function calculatePostViews($postID){ $count_key = 'post_views_count'; $count = get_post_meta($postID, $count_key, true); if($count==''){ ...
0
votes
1answer
29 views

Numbered Pagination Showing The Same Posts After Altering WP_Query

I think the title sums the problem up, but I'll explain more with the code below. As you can see, I'm trying to start the loop from the second latest post for some theme reasons which forced me to ...
0
votes
0answers
17 views

How to update rewrite rules after making “post” post type hierarchical?

I made the default "posts" post type hierarchical and added a filter to "post_link" that calls get_page_link on the $post->ID if a post parent is present. Then the parent-child-relationship is ...
0
votes
0answers
12 views

Wordpress Website is Auto-Posting strange posts

some days ago i mentioned, that the wordpress homepage I'm running is auto-posting different articles (e.g. with the title "Immediate Products Of RussiansBrides – An Analysis") Technical info about ...
0
votes
0answers
12 views

How to allow dot(.) in slug for custom pages

For this question, I googled and found 2 results. But what I want to do is allow dots in slugs for some pages only. I found results are showing to add a function to function.php file. But it will ...
1
vote
0answers
21 views

How to check a post exist when the permalink has post id in it?

This is my permalink structure /%post_id%-%postname%/ https://example.com/in/140521-test-post/ https://example.com/us/140524-second-post/ How can I check "test-post" exist or not? I'm using wpml ...
0
votes
0answers
10 views

REST API allow POST for particular Cutom Post Type

I created custom end points for my custom post types to get only data that I want like title, content and featured image and few custom fields. I am getting REST json data fine. I am building an app ...
0
votes
0answers
14 views

Finding the original post date

I somehow used a plugin that changed all the post dates on my blog to the same date. Is there anyway to find the original post date and change it back?
0
votes
1answer
23 views

How to get different Related Posts

For some reason most of our blog pages show the same or very similar related posts Im using this code: $tags = wp_get_post_tags($post->ID); if ($tags) { $tag_ids = array(); foreach($...
0
votes
0answers
10 views

Post title only for front/blog page, category, archive, search etc

On any standard blog page dedicated to listing posts (i.e front, blog, category, archive, search etc.), I want to show just the post title rather than the post content. Example of desired output: &...
0
votes
0answers
6 views

Attaching Multiple Posts to my site

I need to find a way to upload multiple posts to my site. Every post will have to show some text, the link of the game and an image. At the moment, I have to create one post at a time. I used some WP ...
1
vote
1answer
22 views

Query all posts of a custom taxonomy term

I am using this code on single.php, This query working well but when post has parent term (that parent also have child terms) this give output all posts of parent & children But in this condition ...
0
votes
2answers
29 views

When creating a post how do you select the format?

When creating a post programmatically (with wp_insert_post();), how do you select the format?
0
votes
1answer
13 views

Filter Hook for post table (not columns)

what is the correct filter hook to manage post list view. I want to show only posts by user roles. I will show you what I mean. I want to filter what posts will be listed not change or edit columns.
0
votes
0answers
12 views

How to hide html tags on revision comparison pages?

I can see the html tags on post revision comparision page by default. Is there any filter or other method which will be helpful if I want to hide those html tags? I just want to use this comparision ...
0
votes
0answers
21 views

How to change date format in widget recent posts

I want to change the date format from September 7, 2019to this format shoing month and date separately. File is this: <?php /** * Widget API: WP_Widget_Recent_Posts class * * @package ...
0
votes
0answers
20 views

Show items from a DB in a Post

How can i add a cicle in a post to show all the images from a DB , i was wonderinf if is possible implement a for or some stuff like that , to bring all the items and show them or print them in a post
0
votes
0answers
16 views

Template with ACF and Pagebuilder

I use the avada theme with the Fusion Builder. Now I want to create some global templates for the posts and fill the content with ACF. Does it make a difference for the performance if I write the ...
0
votes
1answer
14 views

how to give multiple post thumbnails to a post

the image with the red cercles are the post thumbnail images, i want to give each post an image of size 100px X 60px, i dont know how to make it, this will make the website faster , becease it will ...
0
votes
1answer
17 views

Modified core/image rendering not showing in posts - only on pages

I followed this suggestion to slightly modify the rendering of the core/image block. This works perfectly for images on pages. But I need the same rendering also in posts. But the method above does ...
0
votes
0answers
7 views

Problems styling Media Gallery - UI doesn't appear to affect display

So, we recently got our new site built with Underscores, SiteOrigin PageBuilder, and ACF. The issue that we're having is that something in the configuration is wrong and we're having problems adding ...