Modify links when inserted by WYSIWYG editor

The HTML for the inserted internal links are generated by Javascript, so I’m not aware of any easy way to change it. The HTML generation is controlled from the wpLink.htmlUpdate method (HTML mode) and the wpLink.mceUpdate method (TinyMCE mode), in the /wp-includes/js/wplink.js file. Here are some ideas: Add a query parameter to the inserted links: … Read more

Insert Custom HTML After Shortcode

I wonder if you could override the [rev_slider] with this kind of wrapper: add_shortcode( ‘rev_slider’, function( $atts = array(), $content=”” ) { $html=””; // Your custom banner HTML $banner=”<div id=”bannerHTML”><!– banner HTML goes here –></div>”; // Append your banner HTML to the revslider’s output if( function_exists( ‘rev_slider_shortcode’ ) ) $html = rev_slider_shortcode( $atts, $content ) … Read more

Advanced Custom Fields and Yoast SEO keyword analysis [closed]

Looking at the filter: $post_content = apply_filters( ‘wpseo_pre_analysis_post_content’, $post->post_content, $post ); it would be a matter of adding your fields content to string being analyzed. You have to do the get_field() part right, this is untested: add_filter( ‘wpseo_pre_analysis_post_content’, ‘filter_yoasts_wpse_119879’, 10, 2 ); function filter_yoasts_wpse_119879( $content, $post ) { $fields = get_field( ‘name’, $post->ID ); return … Read more

Valid characters for actions, hooks and filters

When you “hook”/add_action/*_filter(‘whatever’); a callback function to do_action(‘whatever’);, then you basically add the function (or object-method) name to the global $wp_filters-array. Doing so, you add the function/method name to an array that is built like the following $wp_filter[ $tag ][ $priority ][ $idx ] // $tag = action/filter name // $priority = 3rd argument / … Read more

remove_filter( ‘the_content’, ‘wpautop’ ); only for certain post types

Hook into the_content before the wpautop filter has been called, check the post type, and remove the wpautop filter, which is added in wp-includes/default-filters.php with the default priority 10: add_filter( ‘the_content’, ‘wpse_82860_remove_autop_for_posttype’, 0 ); function wpse_82860_remove_autop_for_posttype( $content ) { # edit the post type here ‘post’ === get_post_type() && remove_filter( ‘the_content’, ‘wpautop’ ); return $content; … Read more

Clarification on filters and hooks

I am confused because add_filter uses the word add when I feel like it is more on the lines of replace or overwrite (unless I am misunderstanding) You are misunderstanding. Both add_action and add_filter insert function callbacks into a kind of queue. You can add many callbacks to the same hook and they will fire … Read more

Filter username field on registration for profanity and unwanted words

There are two very different hooks you can use, depending on the installation: wpmu_validate_user_signup for multi-site and registration_errors for single-site. The following untested code shows how to use them. You can tweak the array in user_name_is_forbidden() to your needs. Use regular expressions for the matches. // multi-site add_filter( ‘wpmu_validate_user_signup’, function( $result ) { // there … Read more

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