bobbingwide / oik-shortcodes

Shortcode, block and API server
https://www.oik-plugins.com/oik-plugins/oik-shortcode-server/
GNU General Public License v2.0
1 stars 0 forks source link

Generated documentation for wp_insert_site appears incomplete #67

Open bobbingwide opened 5 years ago

bobbingwide commented 5 years ago

Three things.

  1. The documentation for the new api wp_insert_site is incomplete.. It's not showing any of the sections before the source code: Description, Usage, Parameters, Returns, Source etc.
  2. The installed wp-a2z repo on wp-a2z.org reports that it's ahead by 20 commits.
  3. If I try to run oik-shortcodes against a local install it fails since the last stored commit ( e704d23 Merge remote-tracking branch 'origin/master' ) is not known in the local install.
bobbingwide commented 5 years ago

Also, when rerunning the build locally I saw

Processing: end_lvl,Walker_Page::end_lvl,wp-includes/class-walker-page.php

Warning: count(): Parameter must be an array or an object that implements Countable in C:\apache\htdocs\wordpress\wp-content\plugins\oik-shortcodes\shortcodes\oik-api-importer.php on line 502

Warning: count(): Parameter must be an array or an object that implements Countable in C:\apache\htdocs\wordpress\wp-content\plugins\oik-shortcodes\shortcodes\oik-api-importer.php on line 1129
bobbingwide commented 5 years ago

Investigation of 1. indicates that uncommenting a commented out bw_flush() in oikai_build_apiref() resolves the problem... but I don't know why. It would appear that the problem occurs in oikai_listsource() when $parsed_source is null... meaning that we can't use the parsed_source entry.

Further investigation, in which I needed to actually use Xdebug for the first time in over 2 years, indicates that the problem occurs when a new hook is created. Yoast SEO hooks into save_post and the post_content is expanded in WPSEO_Link_Watcher logic. Because the post's content includes [bw_fields] this shortcode is expanded. The shortcode invokes bw_ret() to return the echo'd content. Since no bw_push() has been done the content returned includes all the stuff echo'd so far for the current post. This content is therefore lost.

Options to fix.

bw_push();
oikai_syntax_source( $selection, 1 );
$parsed = bw_ret();
bw_pop();
e( $parsed );
 bw_push();
  $post_id = _oikai_create_oik_hook( $hook, $context );
  bw_pop();

Hook functions attached to save_post are

: 10   delete_get_calendar_cache;1 WPSEO_Link_Watcher::save_post;2 WPSEO_Post_Type_Sitemap_Provider::save_post;1 bw_effort_save_postdata;3

These are attached even when it's the front-end.

bobbingwide commented 5 years ago

I chose a belt and braces solution:

  1. Remove all filters attached to 'save_post'
  2. Wrap the call to _oikai_create_oik_hook. The new version of the plugin is now installed on wp-a2z.org.
bobbingwide commented 5 years ago

Now for wp-a2z being ahead. This is associated with the bobbingwide/wp-a2z repo.

  1. git pull --rebase with a bit of fiddling of .gitignore got it to 1 commit ahead.
  2. Some more fiddling of .gitignore will make it 2 commits ahead.
bobbingwide commented 5 years ago

For the third problem. Pushing the changes from wp-a2z.org back into the master, pulling it and updating .gitignore a little more enabled me to get the missing commit into my local version. I'm completely rebuilding core.wp.a2z, but the other subdomains in the local version seem to update correctly.

bobbingwide commented 4 years ago
  1. Remove all filters attached to 'save_post'

This was the main problem in #71. It unintentionally removed the filter function provided by oik_fields which saves the post meta data set in the $_POST global variable. The problem didn’t occur until the second API is processed.

The QAD fix is to re-add oik-field’s filter function.

It would be more efficient if this was done outside of the main loop. Maybe I should start implementing peer reviews.