Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Caldera Form example for frontend post creation to show only for admins.
<?php
/**
* Example for front end post edit with Caldera Forms. Use code to show a Caldera Form at the bottom of a single post if user is an Administrator for WordPress.
*/
add_filter( 'the_content', 'show_cf_form_for_admins' );
function show_cf_form_for_admins( $content ) {
if( is_single() && current_user_can( 'edit_posts' ) ){
//change to your form ID you would like to display.
$content .= Caldera_Forms::render_form( 'CF58e4c8ae55fa2' );
}
return $content;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.