What is the function to get plugin base url in multisite?

The plugins_url() function is designed to work in WordPress Multisite. Here is an example of its proper usage: <?php echo “<img src=”‘ .plugins_url( ‘images/wordpress.png’ , __FILE__ ). ‘” > ‘; ?> If you are using this function in a file that is nested inside a subdirectory, you should use PHP’s dirname() function: <?php echo “<img … Read more

Can I turn off write-in tags/taxonomies?

Here is what I came up with, seems to work: add_filter( ‘pre_post_tags_input’, ‘no_tags_input_create’ ); add_filter( ‘pre_post_tax_input’, ‘no_tax_input_create’ ); function no_tags_input_create($tags_input) { $output = array(); foreach( $tags_input as $tag ) if( term_exists( $tag, ‘post_tag’) ) $output[] = $tag; return $output; } function no_tax_input_create($tax_input) { if( !isset($tax_input[‘post_tag’]) ) return $tax_input; $output = array(); $tags = explode(‘,’, $tax_input[‘post_tag’]); … Read more

Custom wp_trim_words() function not trimming right

What about using this function in functions.php: function new_excerpt_length($length) { return 20; } add_filter(‘excerpt_length’, ‘new_excerpt_length’); And then getting it by adding<?php the_excerpt()?> to php template? OR: <?php $string = get_the_excerpt(); if (strlen($string) <=20) {echo ” . $string . ”;} else {echo ” . substr($string, 0, 20) . ‘…’;}?> In this case 20 is characters

Preferred Use of home_url()?

Million ways in WordPress to use home_url() or sister functions. The question to ask is: What function is a wrapper for other function? To summarize, if you like to concatenate you may use: get_bloginfo(‘url’); get_option(‘home’); If you like to have the control over scheme (http or https) get_site_url( $blog_id, $path, $scheme ); get_home_url( $blog_id, $path, … Read more

Removing unnecessary wordpress files

If you don’t use any 3rd services such as XMLRPC | REST API | oEmbed | Windows Live Writer, removing those lines/headers doesn’t affect anything to your site. Those lines of code is the best way to archive what you want. To remove xmlrpc.php?rds, you need another line: remove_action(‘wp_head’, ‘rsd_link’); Put all of them in … Read more

Use functionality of 2 wordpress plugins

Levi Dulstein has a lot of righ, but in my opinion Front-end-pm uses two hooks to send messages: fep_save_message (from back-end) fep_action_message_after_send (from front-end) Before sending a email few things are checked, like publishig or sending status (includes/class-fep-emails.php): function save_send_email( $postid, $post ) { if ( ! $post instanceof WP_Post ) { $post = get_post( … Read more