Quantcast
Viewing all articles
Browse latest Browse all 13924

bcworkz on "save_post & post_status help"

$_POST["content"] is a PHP array element containing the post content submitted when you click "Update". This content is in a textarea form element with the attribute name="content".

There should not be a $_POST["post_content"] because there is no form element with that name. Where 'post_content' comes from is the column name in the WP posts DB table. As such, when you use a function such as get_post(), 'post_content' is a key name of the post array returned by the function. So if your code was:
$mypost = get_post(227, ARRAY_A);

$mypost will be assigned an associative array for post ID 227 (because of the ARRAY_A parameter, otherwise by default you get an object). Thus you can access the post's content with $mypost["post_content"]. But the super global $_POST would typically never have an array key "post_content" unless some theme or plugin modified an edit form.


Viewing all articles
Browse latest Browse all 13924

Trending Articles