How to make dynamically-generated content searchable in WordPress?

The wp_posts table has a post_content_filtered column that plugins can use to cache expensive post content filters. The idea is that when you display the page, you don’t read post_content but you read post_content_filtered. This is nice, but it won’t solve your search problem because WordPress by default only looks at post_content and post_title. You … Read more

custom XMLRPC method plus authentication of user & WooCommerce order

I sent it to you on Twitter, but here it is again. I made this little class to help me do XML-RPC faster. abstract class MZAXMLRPC { protected $calls = Array(); protected $namespace = “myxmlrpc”; function __construct($namespace){ $this->namespace = $namespace; $reflector = new ReflectionClass($this); foreach ( $reflector->getMethods(ReflectionMethod::IS_PUBLIC) as $method){ if ($method->isUserDefined() && $method->getDeclaringClass()->name != get_class()){ … Read more

Make Categories and Tags required in admin

The JavaScript function is a bit wrong, its catching the form submit instead of the button click change it to this: function my_publish_admin_hook(){ if(is_admin()) { echo” <script language=\”javascript\” type=\”text/javascript\”> jQuery(document).ready(function() { jQuery(‘#publish’).click(function() { var form_data = jQuery(‘#post’).serializeArray(); form_data = jQuery.param(form_data); var data = { action: ‘my_pre_submit_validation’, security: ‘”;echo wp_create_nonce( ‘pre_publish_validation’ ); echo”‘, form_data: form_data }; … Read more

Get specific color from admin color scheme

Color schemes are registered globally within $_wp_admin_css_colors (see wp-includes/general-template.php for reference). You can return the colors for the current user depending on get_user_meta() for a specific settings page like this: global $pagenow; if ( $pagenow == ‘options-permalink.php’ ) : add_action( ‘admin_notices’, ‘get_current_user_admin_color’ ); function get_current_user_admin_color() { global $_wp_admin_css_colors; $user_admin_color = get_user_meta(get_current_user_id(), ‘admin_color’, true); echo ‘<pre>’; … Read more

Customizing subject in comment notification e-mails

If I understand you correctly you want to change the subject line of the email. The hook of your code only changes the content of the e-mail. There’s a different hook for the subject: add_filter(‘comment_notification_subject’, ‘wpse_228315_comment_notification_subject’); function wpse_228315_comment_notification_subject($subject, $comment_id){ return “New comment”; }