Site logo

Archived topic

Problem with function in hook element

3 replies · Started by Carsten on September 11, 2020

Viewing posts 1–4 of 4

Hi there, I'm adding this snippet to a hook element, but this partly breaks the site

<?php  
hmk_show_matching_percentage();  
?>

This is the function, which is working, but I want to control the position of it with a hook. It does not matter which hook I select, same result.

/**
  * Load the matching stuff only if BuddyPress is active.
  */
  function mp_bp_match_init() {

      require_once('src/class.settings-api.php');
  		require_once('mp-settings.php');

      new WeDevs_Settings_API_Match();

      add_action('wp_footer', array($this, 'hmk_script'), 100);

 

<blockquote>Function from this line:</blockquote>

  add_action('bp_profile_header_meta', array($this, 'hmk_show_matching_percentage'), 10);
      add_action('bp_directory_members_item', array($this, 'hmk_matching_percentage_button'), 10);

      add_shortcode( 'mp_match_percentage', array($this, 'mp_match_percentage_function'));

      add_action('wp_ajax_hmk_get_percentage', array($this, 'hmk_get_percentage_function'), 100);
      add_action('wp_ajax_nopriv_hmk_get_percentage', array($this, 'hmk_get_percentage_function'), 100);

   }

Any idea why this code snippet

<?php  
hmk_show_matching_percentage();  
?>

pasted in a hook element is breaking the site?

Thanks!

Hi there,

The hook element doesn't alter or change the function for you - it simply adds the function to the desired location so I'd assume the function itself is causing the issue.

Maybe try removing each line one by one to determine the issue that way?

That is not a theme related function so not sure how much help we can provide here.

Okay, thanks anyway!

No problem :)

This archived topic is closed to new replies.