I'd like to modify a plugin's php file that has only a bunch of if/else and echo statements. I can do it by copying the file into the child theme folder and changing the one little thing, but if the theme gets updated, these updates won't get into the copied file, will they?

Here is part of the file:

<a class="logout with-icon" href="<?php echo wp_logout_url( get_permalinks() ) ?>" data-icon="&#xf08b;"><?php _e('Log out', 'franklin') ?></a>

<?php elseif ( $crowdfunding_enabled && ! is_user_logged_in() ) : ?>

    <a class="user-login button with-icon button-alt button-small" href="#" data-reveal-id="login-form" data-icon="&#xf007;"><?php _e('Login / Register', 'franklin') ?></a>

<?php endif ?>

I want to change

wp_logout_url( get_permalinks() )


wp_logout_url( home_url() )

There are no actions or filters in this file to add/remove. I've seen other answers that say to fork the plugin first. But then the forked version doesn't get any updates. Is there any other way to make this small modification?


The reason I wanted to do this in the first place was to have the user go to the home page after logging out. After some research (an some more learning), I found out that all that was needed was this line in the child-theme's function file:

  • There are no actions or filters at all?
    – s_ha_dum
    Commented Jul 1, 2015 at 4:44
  • None. It is strictly to display html. But now that you mention it, there must be some function somewhere in another file that calls this file. So then, this being a plugin, could I do an "add/remove function" in the child theme's functions file?
    – 1td
    Commented Jul 9, 2015 at 12:46
  • Find another plugin which is more flexible or use code directly in your child theme. Commented Jul 10, 2015 at 16:10

1 Answer 1


Given that there are no filters in the theme that you could manipulate, this is a bit tougher but you can alter the logout URL in general with the logout_url filter:

function hack_logout_url_wpse_193113($logout_url, $redirect) {
  $logout_url = parse_url($logout_url);
  if (!empty($logout_url['query'])) {
    $qry_str['redirect_to'] = urlencode(home_url());
  $logout_url['query'] = build_query($qry_str);
  $ret = '';
  foreach ($logout_url as $k=>$v) {
    switch ($k) {
      case 'scheme':
        $ret .= $v.'://';
      case 'host':
      case 'query':
        $ret .= $v;
      default :
        $ret .= $v.'/';
  return $ret;
echo wp_logout_url(get_permalink());
  • Thank-you for your answer, but my programming skills are still in their infancy and I can't make heads or tails from your code. It seems like a lot of code for such a simple thing.
    – 1td
    Commented Jul 22, 2015 at 19:57
  • Then again, if you can't write the code, or even understand it, how do you know what is a lot? Or how simple the problem is in the first place?
    – s_ha_dum
    Commented Jul 22, 2015 at 20:01
  • I meant no offence, I'm just surprised by how much has to be done to simply change get_permalinks to home_url. I'm not disputing your answer, I just don't understand it (in particular the three cases in the switch statement).
    – 1td
    Commented Jul 22, 2015 at 20:18
  • No offense taken. The switch compensates for some possible variation in URL schemes. It isn't strictly necessary but makes the code more portable.
    – s_ha_dum
    Commented Jul 22, 2015 at 20:20
  • Hope you don't mind my questions. Thanks to WP Codex and PHP Manual, I think I understand. When the user logs out, you pick up whatever is after the question mark in the URL and change it to home_url(). The foreach modifies the components of the entire URL, if necessary. However, I don't understand the last echo statement. Why is the wp_logout_url set to get_permalink instead of home_url?
    – 1td
    Commented Jul 22, 2015 at 21:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.