Skip to content

"Hide Republish Button" checkbox on posts shows "The Republication sharing widget on this post is programatically disabled..." message for filter only #67

@joshdarby

Description

@joshdarby

Screen Shot 2019-11-21 at 12 28 27 PM

When you check the "Hide Republish Button on this Post?" checkbox, on reload the metabox shows the The Republication sharing widget on this post is programatically disabled through the hide_republication_widget filter. message that should only show when the filter is disabling it.

This is happening because if $hide_republication_widget is true, regardless of whether or not the filter is set, the first conditional fires.

https://github.com/INN/republication-tracker-tool/blob/7925e9275baabed9e19072bd67b7d4af226b6cab/includes/class-article-settings.php#L147-L172

$hide_republication_widget = apply_filters( 'hide_republication_widget', $hide_republication_widget, $post );

if( true == $hide_republication_widget ){
	echo '<p>The Republication sharing widget on this post is programatically disabled through the <code>hide_republication_widget</code> filter. <a href="https://github.com/INN/republication-tracker-tool/blob/master/docs/removing-republish-button-from-categories.md" target="_blank">Read more about this filter</a>.</p>';
} else {

should probably be updated to something along the lines of

$hide_republication_widget_by_filter = false;
$hide_republication_widget_by_filter = apply_filters( 'hide_republication_widget', $hide_republication_widget_by_filter, $post ); 

if( true == $hide_republication_widget_by_filter ){
	echo '<p>The Republication sharing widget on this post is programatically disabled through the <code>hide_republication_widget</code> filter. <a href="https://github.com/INN/republication-tracker-tool/blob/master/docs/removing-republish-button-from-categories.md" target="_blank">Read more about this filter</a>.</p>';
} else {

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions