Title: generic_ping
Published: April 25, 2014
Last modified: February 24, 2026

---

# generic_ping( int $post_id ): int

## In this article

 * [Parameters](https://developer.wordpress.org/reference/functions/generic_ping/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/generic_ping/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/generic_ping/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/generic_ping/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/generic_ping/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/generic_ping/?output_format=md#wp--skip-link--target)

Sends pings to all of the ping site services.

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/generic_ping/?output_format=md#parameters)󠁿

 `$post_id`intrequired

Post ID.

## 󠀁[Return](https://developer.wordpress.org/reference/functions/generic_ping/?output_format=md#return)󠁿

 int Same post ID as provided.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/generic_ping/?output_format=md#source)󠁿

    ```php
    function generic_ping( $post_id = 0 ) {
    	$services = get_option( 'ping_sites' );

    	$services = explode( "\n", $services );
    	foreach ( (array) $services as $service ) {
    		$service = trim( $service );
    		if ( '' !== $service ) {
    			weblog_ping( $service );
    		}
    	}

    	return $post_id;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/comment.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/comment.php#L3148)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/comment.php#L3148-L3160)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/generic_ping/?output_format=md#related)󠁿

| Uses | Description | 
| [weblog_ping()](https://developer.wordpress.org/reference/functions/weblog_ping/)`wp-includes/comment.php` |

Sends a pingback.

  | 
| [get_option()](https://developer.wordpress.org/reference/functions/get_option/)`wp-includes/option.php` |

Retrieves an option value based on an option name.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/generic_ping/?output_format=md#changelog)󠁿

| Version | Description | 
| [1.2.0](https://developer.wordpress.org/reference/since/1.2.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fgeneric_ping%2F)
before being able to contribute a note or feedback.