Modify search form with plugin

Here’s an alternative way to only make the product post type searchable, from a plugin code: <?php /** Plugin Name: Product Search Only **/ add_filter( ‘register_post_type_args’, function( $args, $post_type ) { $args[‘exclude_from_search’] = true; if( ‘product’ === $post_type && (bool) $args[‘public’] ) $args[‘exclude_from_search’] = false; return $args; }, 999, 2 ); Here we modify the … Read more

Proper structure for first WP plugin?

More research at the WordPress Codex and related sites for current (2016/2017) solutions … the following tested and works fine … ` defined(‘ABSPATH’) or die(‘No direct file access allowed!’); // Modify post content function myplugin_filter_content($content) { return $content . ‘ Almost an error message but not quite. ‘; } add_filter(‘the_content’, ‘myplugin_filter_content’); function schema_TinyMCE_init($in) { $props=”@[id|class|style|title|itemscope|itemtype|itemprop|datetime|rel],div,dl,ul,dt,dd,li,span,a|rev|charset|href|lang|tabindex|accesskey|type|name|href|target|title|class|onfocus|onblur]”; … Read more