Opened 3 years ago

Last modified 18 months ago

#12955 new feature request

Add get_post filter

Reported by: JohnLamansky Owned by:
Priority: normal Milestone: Future Release
Component: General Version:
Severity: normal Keywords: has-patch filter
Cc: mikeschinkel@…, JohnLamansky, meqia

Description

This patch filters the return value of the get_post() function. I would find this very helpful for a plugin I'm developing.

Attachments (1)

post.php.diff (687 bytes) - added by JohnLamansky 3 years ago.

Download all attachments as: .zip

Change History (10)

  • Keywords has-patch added

comment:2 follow-up: ↓ 4   dd323 years ago

Out of interest, What is the use-case for this exactly?

  • Cc mikeschinkel@… added

comment:4 in reply to: ↑ 2   JohnLamansky3 years ago

Replying to dd32:

Out of interest, What is the use-case for this exactly?

I'd like to filter posts retrieved via XMLRPC/APP. Currently, the function chain goes like this: XMLRPC/APP method -> wp_get_single_post() -> get_post() -- None of these functions are filtered. Right now I have to manually override every single XMLRPC/APP method that retrieves posts, which is a pain. I'd love to be able to filter get_post() like this:

if ( defined('XMLRPC_REQUEST') || defined('APP_REQUEST') )
	add_filter( 'get_post', 'my_plugin_function' );
  • Cc JohnLamansky added
  • Keywords filter added
  • Milestone changed from 3.0 to Future Release
  • Milestone changed from Future Release to 3.0
  • Summary changed from Filter request for get_post to Add get_post filter

Since this filter would really help me with a plugin I'm developing, I'd really like to have it for 3.0 so I don't have to wait several more months for 3.1, if at all possible.

  • Milestone changed from 3.0 to Future Release

There is technically a workaround available. It's a pain as you say, but I don't want to change this so late in the development cycle.

  • Cc meqia added
  • Type changed from enhancement to feature request

Hello,
I apologize for my bad english but why you have abandoned the idea of ​​a filter to the function get_post(); ? Because it would be interesting to provide change the values ​​returned. For example when using the function wp_nav_menu() who call get_post();


Bonjour,
veuillez m'excuser pour mon mauvais anglais mais pourquoi vous avez abandonné l'idée de mettre un filtre sur la fonction get_post(); ? Car il serait intéressant de pourvoir modifier les valeurs retournées notamment lorsque l'on utilise la fonction wp_nav_menu(); qui appel get_post();

Note: See TracTickets for help on using tickets.