Records the IP address of the original post author when a post first gets created.
This plugin records the IP address of the original post author when a post first gets created.
The admin listing of posts is amended with a new “Author IP” column that shows the IP address of the author who first saved the post.
The plugin is unable to provide IP address information for posts that were created prior to the use of this plugin.
Links: Plugin Homepage | Plugin Directory Page | GitHub | Author Homepage
The plugin is further customizable via four filters. Typically, code making use of filters should ideally be put into a mu-plugin or site-specific plugin (which is beyond the scope of this readme to explain).
c2c_show_post_author_ip_column (filter)
The ‘c2c_show_post_author_ip_column’ filter allows you to determine if the post author IP column should appear in the admin post listing table. Your hooking function can be sent 1 argument:
Argument :
Example:
/** * Don't show the post author IP column except to admins. * * @param bool $show_column Should the column be shown? Default true. * @return bool */ function post_author_ip_column_admin_only( $show ) { if ( ! current_user_can( 'manage_options' ) ) { $show = false; } return $show; } add_filter( 'c2c_show_post_author_ip_column', 'post_author_ip_column_admin_only' );
c2c_get_post_author_ip (filter)
The ‘c2c_get_post_author_ip’ filter allows you to customize the value stored as the post author IP address. Your hooking function can be sent 2 arguments:
Arguments :
Example:
/** * Store all IP addresses from local subnet IP addresses as the same IP address. * * @param string $ip The post author IP address. * @param int $post_id The post ID. * @return string */ function customize_post_author_ip( $ip, $post_id ) { if ( 0 === strpos( $ip, '192.168.' ) ) { $ip = '192.168.1.1'; } return $ip; } add_filter( 'c2c_get_post_author_ip', 'customize_post_author_ip', 10, 2 );
c2c_get_current_user_ip (filter)
The ‘c2c_get_current_user_ip’ filter allows you to customize the current user’s IP address, as used by the plugin. Your hooking function can be sent 1 argument:
Argument :
Example:
/** * Overrides localhost IP address. * * @param string $ip The post author IP address. * @param int $post_id The post ID. * @return string */ function customize_post_author_ip( $ip, $post_id ) { if ( 0 === strpos( $ip, '192.168.' ) ) { $ip = '192.168.1.1'; } return $ip; } add_filter( 'c2c_get_post_author_ip', 'customize_post_author_ip', 10, 2 );
c2c_post_author_ip_allowed (filter)
The ‘c2c_post_author_ip_allowed’ filter allows you to determine on a per-post basis if the post author IP should be stored. Your hooking function can be sent 3 arguments:
Arguments :
Example:
/** * Don't bother storing localhost IP addresses. * * @param bool $allowed Can post author IP be saved for post? Default true. * @param int $post_id The post ID. * @param string $ip The post author IP address. * @return string */ function disable_localhost_post_author_ips( $allowed, $post_id, $ip ) { if ( $allowed && 0 === strpos( $ip, '192.168.' ) ) { $allowed = false; } return $allowed; } add_filter( 'c2c_post_author_ip_allowed', 'disable_localhost_post_author_ips', 10, 3 );
post-author-ip.zip
inside the plugins directory for your site (typically wp-content/plugins/
)A screenshot of the admin post listing showing the added "Author IP" column. It demonstrates the mix of a post where the post author IP address was recorded, and posts where it wasn't (due to the plugin not being activated at the time).
A screenshot of the Publish metabox for a post showing the post author's IP address (for versions of WordPress older than 5.0, or later if the new block editor aka Gutenberg is disabled)
A screenshot of the block editor sidebar panel for a post showing the post author IP address (WP 5.0 and later)
The IP address in use at the time that the post is first saved (regardless of whether the post was saved as a draft, immediately published, or some other status) will be recorded.
No, this plugin only records the IP address in use when the post was first saved.
In the upper-right of the page is a “Screen Options” link that reveals a panel of options. In the “Columns” section, check (to show) or uncheck (to hide) the “Author IP” option.
Yes. This plugin is compatible with the block editor as well as the classic editor.
Yes. The IP address stored for authors on the posts they created will be exported on data export requests and deleted for data erasure requests.
Yes.
Highlights:
This recommended release adds GDPR compliance for data export and erasure, modernizes block editor implementation, restructures unit test files, and notes compatibility through WP 5.7.
Details:
register_privacy_erasers()
and remove_ip_address_from_posts_by_email()
for handling data erasure requestsregister_data_exporter()
and export_user_data_by_email()
for handling data export requestsadd_privacy_policy_content()
for outputting suggested privacy policy snippettests/
top-level directoryphpunit.xml
to phpunit.xml.dist
per best practicesHighlights:
This recommended release adds support for all public post types, reduces column width, improves meta key handling, expands unit testing, adds a TODO.md file, updates compatibility to be WP 4.9 through 5.4+, and more internally.
Details:
get_post_types()
for retrieving post typesc2c_stealth_publish_post_types
to filter post typesis_protected_meta()
to protect the meta key from being exposed as a custom fieldget_meta_key_name()
as getter for meta_key namec2c_post_author_ip_meta_key
for customizing meta key namerest_pre_insert()
to add meta key as first-class object property prior to REST-initiated updatetype
attribute for style
tag when the theme supports ‘html5’add_admin_css()
, admin_css()
, add_post_column()
, enqueue_block_editor_assets()
, handle_column_data()
include_column()
, register_meta()
, show_post_author_ip()
, transition_post_status()
get_meta_key_name()
to set default meta key used by teststearDown()
plugins_loaded
action to initialize itselfFull changelog is available in CHANGELOG.md.