Title: Bad coding practice
Last modified: July 22, 2021

---

# Bad coding practice

 *  Resolved [drtonyb](https://wordpress.org/support/users/drtonyb/)
 * (@drtonyb)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/bad-coding-practice-2/)
 * I cannot believe that developers working on Gutenberg have coded like this:
 * `function gutenberg_block_core_page_list_render_nested_page_list( $nested_pages,
   $active_page_ancestor_ids = array(), $colors, $depth = 0 ) {`
 * \wp-content\plugins\gutenberg\build\block-library\blocks\page-list.php on line
   138
 * But, you’re not the only bad coders in the wp plugin world. I’ve encountered 
   numerous other plugins doing this also.
 * Programming 101 – you **never** have a function parameter that is **required**
   FOLLOWING an **optional** parameter.
 * Prior to php8, this practice was tolerated by php7 and php5. Now php8 throws 
   a Deprecated warning.

Viewing 1 replies (of 1 total)

 *  Plugin Author [Daniel Richards](https://wordpress.org/support/users/talldanwp/)
 * (@talldanwp)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/bad-coding-practice-2/#post-14692106)
 * [@drtonyb](https://wordpress.org/support/users/drtonyb/) Thanks for pointing 
   this out.
 * This is the relevant change – [https://github.com/WordPress/gutenberg/pull/31149](https://github.com/WordPress/gutenberg/pull/31149)
 * I’ve put together a fix – [https://github.com/WordPress/gutenberg/pull/33639](https://github.com/WordPress/gutenberg/pull/33639).
 * Feel free to drop into [https://github.com/WordPress/gutenberg](https://github.com/WordPress/gutenberg)
   any time to do code reviews 🙂

Viewing 1 replies (of 1 total)

The topic ‘Bad coding practice’ is closed to new replies.

 * ![](https://ps.w.org/gutenberg/assets/icon-256x256.jpg?rev=1776042)
 * [Gutenberg](https://wordpress.org/plugins/gutenberg/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/gutenberg/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/gutenberg/)
 * [Active Topics](https://wordpress.org/support/plugin/gutenberg/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/gutenberg/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/gutenberg/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Daniel Richards](https://wordpress.org/support/users/talldanwp/)
 * Last activity: [4 years, 10 months ago](https://wordpress.org/support/topic/bad-coding-practice-2/#post-14692106)
 * Status: resolved