Reputation: 371
I'm writing a plugin which will help administrate a question-answer database. 'Candidate' questions are stored in a custom DB, and I'm working on a function by which a user can promote a db question to a fully fledged knowledgebase article (custom post type).
I'd like to populate the content field on post-new.php based on the content of my $_POST data, so a user can click a 'promote' link associated with a candidate and have the information already there.
What's the appropriate filter hook to use for this, or is there a better way?
*Edited title for clarity
Upvotes: 2
Views: 1481
Reputation: 597
I think you need to hook into default_content like this
add_filter( 'default_content', 'my_editor_content' );
function my_editor_content( $content ) {
$content = "This is my default content!";
return $content;
}
as stated here
Upvotes: 0
Reputation: 371
It turns out the filter hook I was looking for is the_editor_content, which will (as its name suggests) let me manipulate the content that gets placed in the editor.
Upvotes: 1
Reputation: 6896
Not exactly sure I have grasped your point, but if the difference between an Q and A entry and a KB entry is more than just a flag in the table, eg it is a largely a copy operation from one table to another: Couldnt you simply use Mysqls INSERT INTO ability? http://dev.mysql.com/doc/refman/5.5/en/insert-select.html which is triggered by the user posting back just the id of the Q and A article?
Upvotes: 1