How to add headers to outgoing email?

Thanks to the above, I’ve realized my central mistake — I didn’t quite realize that the arguments being passed in were a multi-dimensional array. For now, I’ve re-implemented the function thus: function ws_add_site_header($email) { $email[‘headers’][] = ‘X-WU-Site: ‘ . parse_url(get_site_url(), PHP_URL_HOST) ; return $email; } My reading of the wp_mail() source (see: https://core.trac.wordpress.org/browser/tags/4.4.2/src/wp-includes/pluggable.php#L235) leads me … Read more

WordPress Internal @ Mentions

This is a little tricky because sanitize_user allows spaces in usernames, meaning it difficult to avoid grabbing the whole phrase ‘@johndoe said that … ‘ as opposed to just the actual username ‘@johndoe’ and you have no separator at the end that would help. To avoid that I imposed a requirement that spaces in the … Read more

Filter specific shortcode output?

There is no filter that I know of that is meant to target individual shortcodes like you want. You can filter attributes with shortcode_atts_{$shortcode} though. You can hijack another shortcode by creating your own callback and registering it with the original shortcode slug. I think that is what you are probably going to need to … Read more

Why is javascript allowed in my post content?

If you have the unfiltered_html capability then you can use JS. Admins and editors have this capability by default. Personally I use a plugin for fine control of my users’ capabilities, but you can make this change easily in code: $role = get_role( ‘administrator’ ); $role->remove_cap( ‘unfiltered_html’ ); $role = get_role( ‘editor’ ); $role->remove_cap( ‘unfiltered_html’ … Read more

How to add filter with 2 args?

function my_locate_template( $path, $template ){ $path = MY_INCLUDES_DIR . ‘/document/’. $template; return $path; } add_filter( ‘documents_template’,’my_locate_template’, 10, 2 ); add_filter takes 4 variables. The first and second are required. 1. name of the filter, 2. name of the function. The third is the priority (when does the function gets fired). And the fourth is the … Read more

Changing JPEG compression depending on image size

A very special filter The jpeg_quality filter is a really special one: It gets used in three different cases and you’ve to use the second argument to determine, if you want to use the filter or not. Don’t let it do everything The main problem for such a special filter is, that it may fire … Read more

WordPress 3.9 – Trouble Editing TinyMCE 4.0

The strings was new, not more for your requirements. This is the new content of the hook. array ( ‘selector’ => ‘#content’, ‘resize’ => ‘vertical’, ‘menubar’ => false, ‘wpautop’ => true, ‘indent’ => false, ‘toolbar1’ => ‘template,|,bold,italic,strikethrough,bullist,numlist,blockquote,hr,alignleft,aligncenter,alignright,link,unlink,wp_more,spellchecker,wp_fullscreen,wp_adv’, ‘toolbar2’ => ‘formatselect,underline,alignjustify,forecolor,pastetext,removeformat,charmap,outdent,indent,undo,redo,wp_help’, ‘toolbar3’ => ”, ‘toolbar4’ => ”, ‘tabfocus_elements’ => ‘insert-media-button,save-post’, ‘body_class’ => ‘content post-type-post post-status-draft post-format-standard’, … Read more

How many filter/action hooks are healthy?

As long as hooks don’t have anything hooked to them they are no-ops, that is do nearly nothing and have no considerable effect on runtime. It gets quite different when things are hooked and there are a lot of calls. Since you talk about customizing strings the good example would be gettext hook in core. … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)