dougbmorris
Forum Replies Created
-
Forum: Developing with WordPress
In reply to: string WP_Post->ID If Classic Editor PluginAddendum: I am using the ‘save_post’ action hook to register a callable that takes a single argument, the post ID. The post ID is an int like it should be.
Workaround: I added code to the display callback to test if the post ID is a string, and if so, to convert to an int if ( (string) (int) $post_id === $post_id ) and otherwise to return immediately, after sending a diagnostic message to standard out if ( WP_DEBUG ). It seems to be working.
Resolution: Whether or not this issue should be raised for another forum or submitted as a bug I leave to others to decide. I can only guess the issue is with core and that after 2021 it won’t matter. It has a simple workaround. Perhaps this documentation of the issue will help someone.
Forum: Developing with WordPress
In reply to: string WP_Post->ID If Classic Editor PluginThanks, Joy. I just tried the Disable Gutenberg plugin. It’s effect is identical to that of the Classic Editor plugin. If active, ID is a string. If not, ID is an int.
I am surprised that, as far as my searches suggest, no one else is having this particular problem. I always worry about having a unique problem. It suggests I am doing something uniquely not right. The only exception I know is not having the reverse-engineered drivers for a new computer. I got Linux to install 3 months after my initial attempts. Anyway, I can and will (hack) correct the problem in my code and see what happens. I hope this is not a widespread issue.