Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

New answers tagged

0 votes

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

Yes! On the admin menu hook, grab all the post types using get_post_types, then for each type, do a query for posts of that type, and call add_submenu_page with their edit URLs to put them in the menu....
user avatar
  • 51.9k
1 vote

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

Yes you can. By hooking into the admin_menu hook you can add sub menu pages, and they will appear on hover by default. All you have to do is iterate the recent posts and add them one by one. ...
user avatar
0 votes
Accepted

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

The only reason it's talking about revisions is so the TOC still displays when you preview a post. It's nothing to do with your problem, which is that the TOC plugins are looking at your post content, ...
user avatar
  • 51.9k
1 vote

Getting category posts from a certain year

Is there a trick to get for wwx.example.com/year/category/ The main query is open to public query variables like year and cat so without pretty permalinks you could try www.example.com/?year=2022&...
user avatar
  • 63.9k
0 votes

Add static text to post URLs

if i good understand your problem, you should to go: Dashboard -> Settings -> Permalinks and in "Common Settings" section select checkbox "Custom Structure" and here paste: /...
user avatar
  • 1
1 vote

Invisible spam post in backend

I've discovered that Wordpress will NOT show the posts in the Posts List (in wp-admin) if the post's user does not exist. For whatever reason, my WP database does not have a foreign key constraint ...
user avatar
  • 131
2 votes

Get all comments of author's posts

It looks like there's two problem with the code you're trying to use. The first is AUTHOR_ID. Unless you have this defined somewhere else, then this is going to cause an undefined constant error. The ...
user avatar
1 vote
Accepted

ACF to select posts not displaying on blog page

a global $post; before your loops might do the job
user avatar
  • 36
1 vote

The next_posts_link() works only with original $wp_query

I ran into the same issue. I have nested loops, so in the inner loop I am using $wp_query = new WP_Query($args); instead of the global WP_Query. The solution I used was to explicitely pass ...
user avatar
  • 121
-1 votes
Accepted

How to disable edit post option?

This will restrict all users, except admins to edit a post after one day. You can, however, change the allowed user roles or time by simply tweaking the code. function wpse405644_restrict_editing() { ...
user avatar
  • 2,630
0 votes

can't modify post title using the_posts filter

You missed the return statement. function filter_the_posts( $array , $oQuery) { ... $array[0]->post_title='new title'; $array[0]->post_content ='new content'; return $...
user avatar
  • 488
0 votes

Exclude post_meta from Rest API Endpoint

Yes, it's surely possible, but not out-of-the-box. I.e. There's no such REST query parameter in the WordPress core, but you can add it to your REST API request, e.g. via the URL query string, and then ...
user avatar
  • 31.5k
1 vote

Prevent posts with certain post_meta to be edited

I think an elegant way to accomplish this would be to hook into map_meta_cap and deny users as though they do not have the capability to edit the post. This should also gate any other potential work-...
user avatar
  • 5,210
2 votes

Exclude posts w/ specific post_meta on Rest API endpoint

Caveat From the REST API docs: Changing or removing data from core REST API endpoint responses can break plugins or WordPress core behavior, and should be avoided wherever possible. That said, there'...
user avatar
  • 10.3k
0 votes
Accepted

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

Perhaps this filter can help you to modify the query for the specific post type and inside wp-admin as per the documentation, this filter is called before the query is executed so you can modify/...
user avatar
  • 488
0 votes

Search for posts based on their url in the admin?

Or you can go to your mysql database ,Use the search option to find for wp_posts posts table in the column post_name And perform a search! Screenshot :https://prnt.sc/SDQ3QZL1kyZ1 😊
user avatar

Top 50 recent answers are included