Skip to content

Instantly share code, notes, and snippets.

@whalesalad
Created April 23, 2010 04:54
Show Gist options
  • Select an option

  • Save whalesalad/376196 to your computer and use it in GitHub Desktop.

Select an option

Save whalesalad/376196 to your computer and use it in GitHub Desktop.
<?php
$comment_id = wp_new_comment( $commentdata );
$comment = get_comment($comment_id);
/*
Another WordPress rant. Thursday, April 22nd, 2010
---------------------------------------------------------------------------
I found this beautiful bit of code on line 80 of wp-comments-post.php.
I dont't even think I need much explaining to do here.. but this is just
another reason why this software is so effed up. Instead of instantiating
a Comment class with the commentdata - or better - a new comment and adding
the data a bit at a time, the wp_new_comment function is called from the
*global* namespace.
Then you have to use a get_comment function to actually fetch the comment
because instead of having the actual comment obj, you've only got the ID.
How many queries is this? How much of a fucking pain in the ass is it?
How hard is it for a developer, in their template, to echo $comment->body
instead of a ridiculous the_comment() function inside of a "magical loop".
@@@@@@ @@@@@@@ @@@@@@@@ @@@@@@@@ @@@ @@@ @@@ @@@
@@@@@@@@ @@@@@@@@ @@@@@@@@@ @@@@@@@@@ @@@ @@@ @@@ @@@
@@! @@@ @@! @@@ !@@ !@@ @@! @@@ @@! @@@
!@! @!@ !@! @!@ !@! !@! !@! @!@ !@! @!@
@!@!@!@! @!@!!@! !@! @!@!@ !@! @!@!@ @!@!@!@! @!@!@!@!
!!!@!!!! !!@!@! !!! !!@!! !!! !!@!! !!!@!!!! !!!@!!!!
!!: !!! !!: :!! :!! !!: :!! !!: !!: !!! !!: !!!
:!: !:! :!: !:! :!: !:: :!: !:: :!: !:! :!: !:!
:: ::: :: ::: ::: :::: ::: :::: :: ::: :: :::
: : : : : : :: :: : :: :: : : : : : : :
*/
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment