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
2 answers
2k views

creating a custom post template

I want to customize my individual posts. I have an example of what I'm trying to achieve below. Would I make a custom post template for this? If so how would I do this? Or should I add to my single....
0 votes
2 answers
1k views

how to change the permalink to a specific location?

I have this slider on my front page. Right now when I click on an image it goes directly to the permalink and the post. How do I make all the slides go to one specific page? this is the loop for the ...
0 votes
1 answer
1k 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
3 answers
4k views

WordPress is creating a lot of draft posts

My WordPress install (with the following plugins) randomly creates Draft posts whenever I load the posts page. Is there a way to find out which plugin is doing this (aside from deactivating)? Has ...
0 votes
2 answers
1k views

insert thumbnail image from php script

I'm trying to insert a post image thumbnail from my php scritp. It's inserting the post, the content, a download link, and I only need to set the thumbnail image to finish my script. This is my code ...
23 votes
6 answers
85k views

Get the Current Page Number

In a situation where one has 20 posts per page. I would like to get the current page number in order to make some nice page links at the bottom. How do you get the current page. I tried this <?...
0 votes
2 answers
1k views

Set a post expiration and delete a post when expirate

I'm trying to create a function that allows me to delete an article when the date of the day is equal or superior than a date filled in a custom ACF field. I wrote the function below that I placed in ...
0 votes
2 answers
19 views

List of published post dates only outputting one date

I have the following, which works, but only returns a single post date: function test() { $args = array( 'posts_per_page' => -1, 'post_type' => 'post', 'post_status' => 'publish' ); $...
0 votes
1 answer
1k views

Apply filters when loading post via ajax

Have been trying to solve this for couple of hours already. Here's the case: I'm making a plugin that separates the posts into pages using the <!--nextpage--> tag. It works fine but I want to ...
4 votes
9 answers
42k views

Get the current post ID as a variable in Javascript

I'm trying to echo the post ID in a post Javascript and not having any luck. var post_id = '123'; // works fine var post_id = '<?php global $post; echo $post->ID; ?>'; // echos 'ID; ?>'...
3 votes
2 answers
1k views

WP rest api returns 404 only when author param is used

I have a multisite wordpress installation on aws linux, working perfectly fine. The WP Rest api is also working exactly as it should. Except for one single case. /wp-json/wp/v2/posts?author=<some ...
0 votes
1 answer
71 views

WP_Query for multiple post types just shows one

I have an issue, that I do not really understand. I hope, you can help me. I would like to have a WP_query for multiple post types: $query = array( 'category_name' => $category, 'post_type' =&...
0 votes
0 answers
34 views

Don't need backdate publishing option in wordpress website

I don't want backdate publishing of posts on my wordpress website. Is there any way to stop authors from publishing posts in backdate?
0 votes
3 answers
2k views

Show only top 3 posts from 3 categories in order on home page

This function will show the last 3 posts from any category on front page: // Only top 3 posts from CHR category add_action('pre_get_posts', 'ad_filter_categories'); function ...
0 votes
1 answer
1k views

Add checkbox in admin post list - show checked post in widget

I try to make a plugin with a widget where I can mark / check posts, maybe old post I want to bring back to life. I want to add a checkbox in the field before the title, like I try to show in the ...
0 votes
1 answer
6k views

How to search through "post title" and "tags" using WP_Query?

In my custom search form, i'm currently using these kind of $args with my WP Query: $args = array( 'post_type' => 'post', 'posts_per_page' => $postsPerPage, 'offset' =&...
0 votes
1 answer
783 views

Users cannot post when editor or admin on more than 1 site on multisite

Just upgraded to 3.6.1 last week. I have rolled back and re-upgraded 2 times. When I roll back everything works. I've Turned off plugins, changed to 2012 theme. Tried 3.7 with same issues. Users can ...
0 votes
1 answer
1k views

Page updates appear in Preview but not live version?

I have made some changes to a blog page and excluded some categories. However, whenever I view the blog online the excluded posts still appear. But when I got to the blog page and click 'preview' the ...
3 votes
2 answers
2k views

Wordpress Child Category Display All Posts

I am creating a Wordpress page where all my posts in the child categories of team are displayed in a grid. I got this working with the below code. The formatting and general layout is great however it ...
1 vote
2 answers
9k views

Dynamic dependent Dropdown lists for categories, sub-categories and posts

I'm using WordPress 3.5. I need a way to implement a code or plugin to allow users to navigate through posts using dependent(chained) dropdown lists. In other words I would like 3 dropdown menus to ...
2 votes
2 answers
3k views

How do I find which articles are missing a featured image in The WordPress database?

How do I search the database to find out which articles are missing a featured image on them? I looked around in the wp_posts table and searched post_type is equal to article. It gives me a list of ...
1 vote
0 answers
8 views

Wordpress menu disappears in category pages

I have a custom query to order and display posts in my functions.php, and I noticed that the navigation menu disappear in those categories! function my_filtro_ed_ordine( $query ) { if ( ...
0 votes
2 answers
1k views

Redirect old Posts URL to new URL

This may have a simple answer I'm not aware of, but I'm not familiar with redirects on Wordpress. Here's my question: I had my default Posts routed to mysite.com/post-name. I want to now route the ...
1 vote
1 answer
26 views

Wordpress Rest API Post request from AMP

I am trying to figure out how to send a post request to a WP Rest API function on an AMP Page. The endpoint requires 2 fields, post_id & nonce. /wp-json/wordpress-popular-posts/v2/views/[post_id] ...
3 votes
1 answer
2k views

How to edit wordpress RSS feed to show post title only

Hi everyone can someone help me on how to edit WordPress rss feed to show only title of the post, i use android application that display notification as rss feed that's why i want to show only a title ...
1 vote
1 answer
21 views

REST API - Retrieving posts with custom status

I am still in the process of learning how to use the WordPress REST API and am attempting to retrieve all posts which have been assigned the custom status "archived". I have already created ...
2 votes
1 answer
3k views

how load content as pop-up using ajax

There's a way to use ajax to load the content from single.php or a custom .php like ajax-single.php like this page does it: https://yellowimages.com/all/objects/apparel-mockups/ also like them show ...
0 votes
2 answers
2k views

Show a page counter for pagination

I currently have simple pagination set up showing the text older and newer. If one of the text isn't needed it display an 'inactive' version of it so that the text doesn't disappear. <?php if( ...
0 votes
1 answer
2k views

previous and next post of same category on singlepost.php

I want to show previous and next posts of same category in wordpress My code is : <?php $prev_post = get_previous_post(); $next_post = get_next_post(); ?> &...
0 votes
2 answers
2k views

Deleted page still shows and is showing posts archive

I have a weird issue. I deleted a page and permanently deleted in from the trash but I can still get to it. On the deleted page it shows the posts page ("Blog" page). I have cleared the permalinks, ...
-2 votes
0 answers
26 views

Correcting code written by Chat GPT for displaying actual author of the post

Under the USERS i have created 8 users. When one of those 8 users are loged in, they can write new post and publish it, and before they publish it they can select from the author dropdown list any ...
0 votes
2 answers
2k views

how to redirect page after delete post inside a post page?

so on theme single.php i want to put delete button so they can delete the post directly. After the post deleted then the page will redirect to profile page. here's the delete button html <a class=...
82 votes
15 answers
153k views

Remove slug from custom post type post URLs

It seems that all web resources based on the subject of removing a custom post type slug ie yourdomain.com/CPT-SLUG/post-name are now very outdated solutions often referencing pre WP version 3.5 ...
0 votes
0 answers
22 views

Default post showing more than intended

I have a ajax set up where I am loading post categories via ajax request on click of a button. I have a default query that is loaded for when the ajax filter is not set so a default state. It should ...
1 vote
0 answers
34 views

Ajax load more post button not showing

I have some alpine.js and ajax that is loading wordpress posts on click of a button, this is working well. however I am now trying to add some code to the button to hide if no post available to load, ...
0 votes
1 answer
2k views

REST API Working for GET but not for POST?

I am trying to create a post through the REST API. I am able to access the API by getting the existing posts, as per the screenshot below: However, when I try to do a similar request to create a new ...
3 votes
1 answer
620 views

Filter Posts by Excluding Categories

I am logged on as admin I am on the Posts dashboard I have Posts assigned to multiple Categories and I have posts that are assigned to only one category. I want to display posts that are assigned ...
3 votes
1 answer
870 views

How to delete all posts from a custom post type?

I want to delete all posts from a custom post type "TV-Serie". The number of all posts in this post type are 150,000. Moreover, when I try to delete them all manually while selecting more than 500 ...
0 votes
2 answers
962 views

Looking to exclude blog posts from category Previous/Next buttons

I'm working on some conditional elements here and I thought I had it but it's still not working right. You can see my site here. What I've done is displayed only category Legal Libation Columns (98) ...
0 votes
0 answers
7 views

WP galleries in posts after import. How do I do it?

I moved the website posts with Wp All Export and All import, which worked fine, but many of the posts contained galleries (Wordpresses gallery with [gallery] shortcode). The problem is that now the ...
0 votes
2 answers
1k views

How to display related post from same category in single.php

How to display related the post from same category in single.php. I have tried but it was not working.
0 votes
1 answer
4k views

Display Wordpress Post By Date

I want to show Wordpress post by day/date in homepage. ex: Monday, January 03 post 1 post 2 post 3 Sunday, January 02 post 1 post 2 post 3 Saturday, January 01 post 1 post 2 post 3 What ...
3 votes
2 answers
3k views

Display custom post types by date field

I have a custom post type that is simply titles with a date field. I want to display these posts in a list in order of this date field (not date posted). So simply: -- Sample date Event title 1 ...
0 votes
1 answer
57 views

Can i have limit posts on a specific category and automatically remove older ones?

i need to limit the number of posts on a specific category and if a new post is created and placed this category, but the number of maximum posts is reached, then the older one automatically been ...
1 vote
3 answers
928 views

Issue where WP Featured Image will not display

The code I'm using, is outside of WordPress i.e. define('WP_USE_THEMES', false); require('blog/wp-blog-header.php'); global $wpdb; The code that I'm trying to display the post thumbnail (the set ...
1 vote
1 answer
1k views

WordPress Rest API Create Post

Is it possible to login to my different WP website from another WP website (they have different domain and host) ? Actually, I am trying to create a post on one of my site from my another site using ...
0 votes
1 answer
1k views

Fill the exclude array() in get_posts()

I'm using this code to populate the dropdown menu in a meta box. $parents = get_posts( array( 'post_type' => 'jhk_story', 'orderby' => 'ID', ...
1 vote
1 answer
59k views

Post + form + action + results on the same page

I'm trying to put on a post a custom form and, on the same page I'd like to visualize the results of an action on the form. But I'm missing the basics. Essentially I'd like to do something like this....
0 votes
1 answer
868 views

Adding div to WordPress page content

I am wondering if there is a way to add div to specific elements in the WordPress page content? For example, I would want to wrap a div around content starting at a H2 element and ending after an img ...
1 vote
0 answers
16 views

Search result page admin panel - display values from the result's metaboxes

Help me please.. I have plugin for vacancy/resume/companies in the form of posts on Wordpress. The task is to perform a standard Wordpress search for arbitrary fields inside the record. The fields ...

1
2 3 4 5
121