Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP Warning - undefined array key class-simple-page-ordering.php 433 #200

Closed
1 task done
sissibieber opened this issue Apr 11, 2024 · 1 comment · Fixed by #203
Closed
1 task done

PHP Warning - undefined array key class-simple-page-ordering.php 433 #200

sissibieber opened this issue Apr 11, 2024 · 1 comment · Fixed by #203
Labels
type:bug Something isn’t working.
Milestone

Comments

@sissibieber
Copy link

Describe the bug

when called in the admin, page overview, I get the following php warning:
Undefined array key 32 in /xxx/plugins/simple-page-ordering/class-simple-page-ordering.php 433

While 32 is the parent, that has 2 child pages, which are both set to draft

Steps to Reproduce

  1. admin area
  2. pages overview
  3. warning in debug.log

Screenshots, screen recording, code snippet

No response

Environment information

No response

WordPress information

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@sissibieber sissibieber added the type:bug Something isn’t working. label Apr 11, 2024
@dkotter dkotter added this to the 2.7.1 milestone Apr 11, 2024
@mjot
Copy link

mjot commented Apr 12, 2024

I can confirm this bug, same behaviour for us.

zachgibb added a commit to zachgibb/simple-page-ordering that referenced this issue May 9, 2024
When reordering a custom post type, this `get_walked_pages` call fails with an `undefined array key` error on line 433.

Digging into it more, we can see that the `get_walked_pages` call is outputting only the `top_level_pages` for the `page` post type.

This is due to the `get_pages` call on line 200 (https://github.com/10up/simple-page-ordering/blob/develop/class-simple-page-ordering.php#L200) defaulting to [`post_type => 'page'`](https://developer.wordpress.org/reference/functions/get_pages/#parameters).

If we tweak this to pass in the `post_type` of the post we're working with, in the same way we do with [`is_post_type_sortable`](https://github.com/10up/simple-page-ordering/blob/develop/class-simple-page-ordering.php#L244), this issue will be resolved.
@jeffpaul jeffpaul moved this from Incoming to Code Review in Open Source Practice May 9, 2024
peterwilsoncc added a commit that referenced this issue May 10, 2024
Update get_walked_pages to support custom post types Closes #200
@github-project-automation github-project-automation bot moved this from Code Review to Done in Open Source Practice May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Something isn’t working.
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants