WordPress – crap code

I’ve just been digging through query.php trying to fix a WordPress problem.

And the code I see is staggeringly bad. Yet this is core code.

e.g. take a look at `get_posts()`, pages upon pages of `if` statements. Utterly unreadable and there is no way to figure out how a change might cascade down the code.

I ran the code through a debugger. After staggering through the hundreds of lines of `if` statements I found WordPress was calling the function a 2nd time. So, not only is it incredibly long and incomprehensible. It gets called multiple times.


git reset

`git reset` allows you to undo changes that haven’t been shared yet.

Example A
`git reset` will reset the Staging area to the most recent commit.
1. you have a file in Staging ready to commit and want to remove it from Staging. See this:

$ git st
On branch master
Changes to be committed:
(use “git reset HEAD …” to unstage)

modified: test.txt

Now, to remove it from Staging, use `git reset`, e.g.
git reset

Now you have:
Unstaged changes after reset:
M test.txt
[git-test (master)]$ git st
On branch master
Changes not staged for commit:
(use “git add …” to update what will be committed)
(use “git checkout — …” to discard changes in working directory)

modified: test.txt