Comment “like” problem – “users who like this” avatar linking to current user profile instead of “liker’s” profile

I can’t give more than a partial answer here, since the details might depend on the peculiarities of your theme and installation, including UM and how you’re using it. Without installing and cracking open UM, too, I’m not sure I could figure out why you’re getting the unexpected results you’re getting. However, if you want … Read more

WordPress plugin cron working only if admin is logged in

The WP Cron .. which runs when user hit website .. Thus if there are no website visits, WP Cron never runs. Now you can use 2 solutions. Disable WP-Cron and use real cron job and then custom real cron job https://support.hostgator.com/articles/specialized-help/technical/wordpress/how-to-replace-wordpress-cron-with-a-real-cron-job use custom interval in wp_schedule_event add_filter( ‘cron_schedules’, ‘myprefix_add_a_cron_schedule’ ); function myprefix_add_a_cron_schedule( $schedules ) … Read more

How can I display Custom Post type Custom Columns and its Content in a Dashboard Widget?

To answer your specific question: no, there are no hooks that would allow you to “reuse”. However, there is nothing keeping you from calling your browseCustomColumns() function in your function that renders the dashboard widget. However, in order to do that, you’d have to make a minor change your compile_dashboard_widget() function: public function compile_dashboard_widget () … Read more

Replace first occurence of a word with link [closed]

Try this : function guru20_ReplaceWords($text){ $replace = array(‘WordPress Codex’ =&gt; ‘<a href=”http:/codex.wordpress.com”>WordPress Codex [EN]</a>’, ‘WPRecipes’=&gt; ‘<a href=”http://www.wprecipes.com” target=”_blank”>WPRecipes [EN]</a>’, ‘f.php’ =&gt; ‘In die Datei functions.php einfügen.’); $text = str_replace_first(array_keys($replace), $replace, $text); return $text; } add_filter(‘the_content’, ‘guru20_ReplaceWords’); add_filter(‘the_excerpt’, ‘guru20_ReplaceWords’); function str_replace_first($from, $to, $subject) { $from = “https://wordpress.stackexchange.com/”.preg_quote($from, “https://wordpress.stackexchange.com/”).”https://wordpress.stackexchange.com/”; return preg_replace($from, $to, $subject, 1); } You can … Read more

Action Hook Inside WordPress Plugin Shortcode

It’s not entirely clear what your ultimate goal is, but a simple way to catch a form submission is to hook init and check if something is set: function wpd_check_post_vars(){ if( isset( $_POST[‘first_name’] ) ){ // do something } } add_action( ‘init’, ‘wpd_check_post_vars’ ); There’s no connection here between the action and your Shortcode, it’s … Read more

How to add/change (woocommerce) product tab icon

It seems that these icons are just added with a CSS ::before selector. So if you have something like that to set up your custom tab: function woocommerce_product_write_panel_tabs(){ ?> <li class=”custom_tab”> <a href=”#custom_tab_data_mytab”> <?php _e(‘My Custom Tab’, ‘textdomain’); ?> </a> </li> <?php } Than you should be able to style the a::before with something like … Read more

How to resize WordPress images on upload to specific height and width without cropping it

WordPress’s image resizing does not artwork your image onto a canvas, it just resizes mages to fit, cropping if you tell it to. add_image_size(‘contained-image’, 300, 400); will get you the image size you want, but not letterboxed. Images will be resized to fit tightly within a 300×400 rectangle. However they won’t be padded out to … Read more