frontity / wp-plugins

» Frontity - Create amazing sites using WordPress & React

Home Page:https://frontity.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Will fire an error if no nodes are found.

johnfrancisli opened this issue · comments

$nodes = $dom->getElementsByTagName( 'head' )[0]->childNodes;

This fires an error on situations when it tries to grab the head but no head is set because it will look for a childNode on something null.

Ideally we should have a check like:
$dom_node = $dom->getElementsByTagName( 'head' )[0]; $nodes = $dom_node ? $dom_node->childNodes : [];

Let me know if it makes sense?

Sounds good to me @johnfrancisli 🙂

Would you mind doing a PR with that change?

Sorry didn't see this until now.

@johnfrancisli no problem! 😄

@DAreRodz can you take a look at the PR and run the tests locally?