Overriding a Filter in WordPress and Forcing it to Return True or False
WordPress's add_filter()
function takes the name of a filter and the name of a callback function as args.
The args __return_true
and __return_false
can be applied to a WordPress filter to make it return true or false instead of, for example, creating a unique function that returns true or false to pass as an arg.
For example, to debug YoastSEO's Schema output, the following filter can be added to return pretty JSON:
add_filter( 'yoast_seo_development_mode', '__return_true' );
Or, to disable Schema output entirely:
add_filter( 'wpseo_json_ld_output', '__return_false' );
Feedback?
Email us at enquiries@kinsa.cc.