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

CWS_WP_Help_Plugin::api_slurp() never registers the wp-help post type #59

Open
jibbius opened this issue Sep 17, 2020 · 1 comment · May be fixed by #60
Open

CWS_WP_Help_Plugin::api_slurp() never registers the wp-help post type #59

jibbius opened this issue Sep 17, 2020 · 1 comment · May be fixed by #60

Comments

@jibbius
Copy link

jibbius commented Sep 17, 2020

I have a PULL request that addresses this issue, and will link it shortly.
(This ticket is to supply the background information).

I was seeing errors on my site generated from /wp-cron , related to wp-help.
The error was actually occurring in a different plugin (wp-optimise), however the cause of the error is able to be isolated to wp-help. This is illustrated in lines 6 & 7 in the trace below.
The error is thrown during CWS_WP_Help_Plugin::api_slurp() , when updating posts (i.e. slurped from another URL).

Currently, when CWS_WP_Help_Plugin::api_slurp() is called, it never registers the wp-help post type.

Reasons why I think the post type should be registered as part of api_slurp:

  • It's a one-line code fix to solve.
  • For someone encountering the error, it's not necessarily easy to diagnose.
  • Given we're in the context of WP hooks...etc. it is perfectly reasonable for other plugins to expect that this post type be registered, prior to wp_update_post() being called.

TRACE is as follows:

ERROR: PHP E_NOTICE (#8): Trying to get property of non-object
# 0: /htdocs/wp-content/plugins/wp-optimize/cache/class-wpo-cache-rules.php (106): MyCustomErrorHandler()
# 1: /htdocs/wp-includes/class-wp-hook.php (289): WPO_Cache_Rules::purge_post_on_update()
# 2: /htdocs/wp-includes/class-wp-hook.php (311): WP_Hook::apply_filters()
# 3: /htdocs/wp-includes/plugin.php (478): WP_Hook::do_action()
# 4: /htdocs/wp-includes/post.php (4260): do_action()
# 5: /htdocs/wp-includes/post.php (4354): wp_insert_post()
# 6: /htdocs/wp-content/plugins/wp-help/classes/plugin.php (362): wp_update_post()
# 7: /htdocs/wp-includes/class-wp-hook.php (287): CWS_WP_Help_Plugin::api_slurp()
# 8: /htdocs/wp-includes/class-wp-hook.php (311): WP_Hook::apply_filters()
# 9: /htdocs/wp-includes/plugin.php (544): WP_Hook::do_action()
#10: /htdocs/wp-cron.php (138): do_action_ref_array()
jibbius added a commit to jibbius/wp-help that referenced this issue Sep 17, 2020
@jibbius
Copy link
Author

jibbius commented Sep 17, 2020

Pull request = #60

@jibbius jibbius linked a pull request Oct 15, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant