Skip to:
Content
Pages
Categories
Search
Top
Bottom

Trackbacks


  • cdwed
    Participant

    @cdwed

    I see that users have been asking to fix this problem for years. I am getting hit hard by this on my site. I cannot disable trackbacks. Before I remove BBPress from my site, do you have a patch to fix this annoying problem in your software?
    Peter

Viewing 13 replies - 1 through 13 (of 13 total)

  • Robin W
    Moderator

    @robin-w

    I just looked in trac, and fixing this is now a 2.8 goal.

    However this looks like it might help

    // Force ping_status on bbPress post types 
    add_filter( 'pings_open', 'rew_force_ping_status' ); 
    
    function rew_force_ping_status( $open, $post_id = 0 ) { 
    
    // Get the post type of the post ID 
    $post_type = get_post_type( $post_id ); 
    // Default return value is what is passed in $open 
    $retval = $open; 
    // Only force for bbPress post types 
    switch ( $post_type ) { 
    case bbp_get_forum_post_type() : 
    case bbp_get_topic_post_type() : 
    case bbp_get_reply_post_type() : 
    	$retval = false; 
    break; 
    // Allow override of the override 
    return apply_filters( 'rew_force_ping_status', $retval, $open, $post_id, $post_type ); 
    } 

    cdwed
    Participant

    @cdwed

    OK…do I put this on a forum page as HTML?

    TNX


    Robin W
    Moderator

    @robin-w

    no.

    The simplest way is to use this plugin

    Code Snippets

    and put the code in there


    cdwed
    Participant

    @cdwed

    OK I added the plug-in. Can you give some specific instructions on how to enter the code?

    Do I do this for each forum page?

    TNX Robin.

    Peter


    Robin W
    Moderator

    @robin-w

    if you have put the code in the plugin – that’s it !

    On a load, the code looks to see if it is a topic or reply, and if so turns off pingbacks


    cdwed
    Participant

    @cdwed

    I put in the code and got a syntax error. I loaded it in just as you wrote it. So it will not run.

    Can you check on this please?
    Here is what you posted:

    // Force ping_status on bbPress post types 
    add_filter( 'pings_open', 'rew_force_ping_status' ); 
    
    function rew_force_ping_status( $open, $post_id = 0 ) { 
    
    <strong>// Get the post type of the post ID 
    $post_type = get_post_type( $post_id ); 
    // Default return value is what is passed in $open 
    $retval = $open; 
    // Only force for bbPress post types 
    switch ( $post_type ) { 
    case bbp_get_forum_post_type() : 
    case bbp_get_topic_post_type() : 
    case bbp_get_reply_post_type() : 
    	$retval = false; 
    break; 
    // Allow override of the override 
    return apply_filters( 'rew_force_ping_status', $retval, $open, $post_id, $post_type ); 
    } </strong>

    Robin W
    Moderator

    @robin-w

    you seem to have and in your code, that is not in the version I posted


    cdwed
    Participant

    @cdwed

    I dont get it. I copied your code exactly as below. Is there an AND symbol getting in there in the copy function?

    // Force ping_status on bbPress post types
    add_filter( ‘pings_open’, ‘rew_force_ping_status’ );

    function rew_force_ping_status( $open, $post_id = 0 ) {

    // Get the post type of the post ID
    $post_type = get_post_type( $post_id );
    // Default return value is what is passed in $open
    $retval = $open;
    // Only force for bbPress post types
    switch ( $post_type ) {
    case bbp_get_forum_post_type() :
    case bbp_get_topic_post_type() :
    case bbp_get_reply_post_type() :
    $retval = false;
    break;
    // Allow override of the override
    return apply_filters( ‘rew_force_ping_status’, $retval, $open, $post_id, $post_type );
    }


    Robin W
    Moderator

    @robin-w

    sorry, should have put ‘code’ round the sentence

    so should have read

    ‘you seem to have <strong> and </strong> in your code, that is not in the version I posted’

    but if that is not the issue, can you post the exact error you are getting


    cdwed
    Participant

    @cdwed

    OK…here is what I get for an error message:

    The code snippet you are trying to save produced a fatal error on line 19:

    syntax error, unexpected end of file


    Robin W
    Moderator

    @robin-w

    ah – thanks – try this

    // Force ping_status on bbPress post types
    add_filter( ‘pings_open’, ‘rew_force_ping_status’ ); 
    function rew_force_ping_status( $open, $post_id = 0 ) { 
    // Get the post type of the post ID
    $post_type = get_post_type( $post_id );
    // Default return value is what is passed in $open
    $retval = $open;
    // Only force for bbPress post types
    	switch ( $post_type ) {
    	case bbp_get_forum_post_type() :
    	case bbp_get_topic_post_type() :
    	case bbp_get_reply_post_type() :
    	$retval = false;
    	break;
    	// Allow override of the override
    	return apply_filters( ‘rew_force_ping_status’, $retval, $open, $post_id, $post_type );
    	}
    } 

    cdwed
    Participant

    @cdwed

    OK Robin…that worked! I’ll see how it goes.

    Peter


    Robin W
    Moderator

    @robin-w

    great !

Viewing 13 replies - 1 through 13 (of 13 total)
  • You must be logged in to reply to this topic.
Skip to toolbar