WordPress Plugin Filter

Use the filter method to update not only your WP posts, but also pages!

Updated over a week ago

How does it work?

For now, by default, you can use the plugin only to export content to your WordPress posts. However, the filter method allows you to modify the list of posts possible to update from Surfer by changing post types used for a search query.

This won't allow you to create a new page and export the content there but will let you update your already-existing pages.

FILTER AVAILABLE FROM VERSION: 1.1.2 of our WP plugin

⚠️ To use this filter, you need to know how to use code snippets. If you are not familiar with that, please check our documentation page first! ⚠️

To use hooks, you need basic HTML and PHP knowledge, as those changes are made with code snippets. Our documentation will provide full knowledge and code example for certain snippets, but it is still important to know how this works.

We highly recommend leaving these changes to experts with programming knowledge. Also, we recommend checking if you have a backup of your page just to make sure.

Please, remember that you put those snippets at your own risk. Our support team will not help you to insert snippets and will not debug your custom snippets.


Hook details:

Hook type: Filter

Hook tag: surfer_allowed_post_types

Hook default value: ‘post’

Hook allowed return types: string | array

Example of return types: ‘post’ | array( ‘post’, ‘page’ )


Example code snippet:

add_filter( 'surfer_allowed_post_types', 'my_surfer_allowed_post_types' ); 

/**
* Function will change allowed post types for Surfer content export update.
*
* @param string | array $types - allowed post types. Default: 'post'
* @return string | array
*/
function my_surfer_allowed_post_types( $types ) {
return array( 'post', 'page' );
}


Example result of usage:

So let’s say that initially, we have this posts list:

And also this pages list:

And now, let’s check what, by default, we see in the Surfer export popup:


Now, let’s activate our code snippet from this example and check again what we see in the popup:

As expected, we can now update not only posts but also pages!

Do you need some help? Don't worry! You can contact us at [email protected] or via live chat by clicking the icon in the bottom-right corner.

Did this answer your question?