How to make Advanced Forms (and/or ACF) encode input value?

I believe you need the af/email/before_send hook. I found this solution here: https://gist.github.com/mishterk/70bb486baac349c29b684346b77826ce Rather than permanently modifying the email saved with the form entry, you can simply modify the message field to encode the email. For example: <?php // Set the form key you wish to target $form_key = ‘form_5d97cf9edc0a8’; add_action( “af/email/before_send/key=$form_key”, function ( $email, … Read more

How to decrease the number of queries with get_posts and ACF?

It’s everything OK with get_posts() since it creates the single WP_Query instance per call. You can check the query by creating that instance: <?php $test_query = new WP_Query( array( ‘post_type’ => ‘post’, ‘posts_per_page’ => -1, // any number, does not matter ‘post__in’ => $ids, // should be an array! ) ); echo $test_query->request; Adding ‘meta_query’ … Read more

Check if checkbox is marked on publish/update post

Working code: add_action( ‘acf/save_post’, ‘fritlaeg_artikel_3m’ ); function fritlaeg_artikel_3m( $post_id ) { if( get_post_meta( $post_id, ‘fritlaeg_artikel_i_3_maneder’, true ) ) { // Getting a UNIX Timestamp $timestamp = time(); // Using WordPress Time Constants // https://codex.wordpress.org/Easier_Expression_of_Time_Constants $timestamp_after_hour = $timestamp + 0.5 * MINUTE_IN_SECONDS; // Define remaining parameters $args = array( $post_id ); $hook = ‘fritlaegning_clear_meta_data’; // Get … Read more

Remove headings option from Wysiwyg editor from ACF in a certain custom post type

You can generally edit the capability of the tinyMCE WYSIWYG Editor for ACF with the acf/fields/wysiwyg/toolbars hook. By default the WYSIWYG editor has two toolbars, “Full” and “Basic” but you can also create you own(see docs) Removing the formatting option for the “Full” WYSIWYG editor can be accomplished like this: add_filter( ‘acf/fields/wysiwyg/toolbars’ , ‘my_toolbars’ ); … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)