Filter / hook for custom post types

[ad_1]

Hi, you can use something like this:

add_filter( 'freshforms_post_has_gform', function ( $post_has_form ) {
global $post;

// Run Fresh Forms for all posts of a custom post type.
if ( is_object( $post ) && 'product' === $post->post_type ) {
array_push( $post_has_form, $post->ID );
}

return $post_has_form;
} );

In the above example Fresh Forms will run for any post of product type. Change product to your post type, and that’s all.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer