Closed janboddez closed 1 year ago
@janboddez It is in the readme.
syndication_links_display( true )
- Adds Syndication Links to content display.
Just add a false return to this filter.
Just FYI: the actual issue is definitely still present.
[10-Feb-2023 12:39:10 UTC] PHP Fatal error: Uncaught TypeError: array_merge(): Argument #2 must be of type array, string given in <...>/syndication-links/includes/class-syn-meta.php:97
Stack trace:
#0 <...>/syndication-links/includes/class-syn-meta.php(97): array_merge()
#1 <...>/syndication-links/includes/class-syn-meta.php(102): Syn_Meta::screens()
...
Reappeared the moment I reinstalled and activated the (latest version of the) plugin. (Presumably because the faulty setting is never purged, which is okay, as long as the code itself is able to handle it.)
I'll do the full array check then
Can give it another look later too. Might be sufficient to cast to an array, which I think would give you either an empty array or one with an empty string in it, at least until one or more post types are selected and saved. That would likely prevent the fatal error.
I have to upgrade my dev testing from 7.4 to 8.
@janboddez Check again?
I now get, or rather, got the error on the settings page only instead of it taking down the entire site. :-)
Mind you, I did not purge the settings from the database before reinstalling. Once I selected that first unlabeled checkbox and forced the form to submit, the error disappeared.
I'll have a look at the actual error as soon as I get the chance. (No longer actively using the plugin so it's not super urgent [for me] ...)
Tried the other way of dealing with this.
This works/no longer throws an error.
Might be an edge case, but I ran into this playing around with the settings.
In short, I disabled all post types (which maybe you shouldn't do, but it is possible ...). Looks like the option is then deleted (?), causing
get_option()
to return an empty string (the default).Could likely be fixed by adding a default option (
get_option( '<something-something>', array() )
, or checking for an empty value (if ( empty( $post_types ) )
and so on ...).Speaking of: what is the preferred way to not append any links to
post_content
but keep the WP-Admin meta box? Remove thethe_content
filter? (I'm looking into doing this in a block outside the post content /e-content
.) There's a "no display" setting, but I was under the impression that this would still add hidden links.