WordPress.org

Support

Support » How-To and Troubleshooting » Pingbacks don’t work on pages but on posts only

Pingbacks don’t work on pages but on posts only

  • Hi everyone,

    I have several pages on my blog and I am wondering why automatic pingbacks do not work on pages. Trackbacks on pages work just fine, but not pingbacks from other WordPress blogs.

    Example: http://sw-guide.de/wordpress/math-comment-spam-protection-plugin/

    Check out the list of trackbacks and pingbacks. I know many people who have written about this page and placed a link in their blog posts however the pingbacks do not work — in one case a pingback came thru, though…

    I’m using latest WP version 2.0.5 and pings are of course enabled. And I do not use any plugin that might cause this issue — at least I am not aware of that.
    For posts the pingbacks are working just fine and there is nothing to complaint about.

    Any help is really appreciated.

    Thanks,
    Michael

Viewing 7 replies - 1 through 7 (of 7 total)
  • Moderator Samuel Wood (Otto)

    @otto42

    WordPress.org Tech Dude

    The pingback mechanism is the same for both posts and pages. There’s no reason one should work but not the other.

    Yes, but unfortunately I am actually experiencing that. Also, when I’m testing with local installations and pinging from a WP1.5.2 blog to my 2.0.5 blog it works on posts only but not on pages.

    I could isolate it, the postID representation cannot be retrieved from the permalink by the function url_to_postid() (is being called in the xmlrpc.php), 0 is being returned 🙁
    That means url_to_postid() fails in case of my pages’ permalinks.
    I will try to fix it although I’m not very familiar with regex.

    WP 2.0.5, includes/functions.php
    Line 258
    Replace ” }” with the following code:

    } else {
    // No match, but let's get the id if we're having a page.
    // since the above method fails in some cases for some reasons.
    // Quick and dirty, I know.
    // by Michael Wöhrer, http://sw-guide.de
    $query_pages = 'pagename=' . $request;
    $query = new WP_Query($query_pages);
    if ( $query->is_page )
    return $query->post->ID;
    else
    return 0;
    }

    Works on my local installation & I’ve just uploaded it to my blog’s ftp.

    I’ve the same problem.
    Your code is not up to date but thank you to have directed me.

    url_to_postid() NOT work with static page url in the last stable version.

    Solution for latest WordPress version 2.1.3 is:

    Open /wp-includes/rewrite.php, goto line #143 and replace
    return 0; with the following code:

    $query = new WP_Query('pagename=' . $request);
    if ( $query->is_page )
    	return $query->post->ID;
    return 0;

    I’ve just opened a ticket: http://trac.wordpress.org/ticket/4103

    thank you to have opened a ticket.

    for find post_id of an url with the actual version, I tested :

    $id = url_to_postid($url);
    if(!$id){
      $pages = preg_replace('#^.+/([^/]+)/*$#','$1',$url);
      $query = new WP_Query('pagename='.$pages);
      if($query->is_page) $id = $query->post->ID;
    }

    that work on me and, I think, for others installations.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Pingbacks don’t work on pages but on posts only’ is closed to new replies.