Support

Account

Forum Replies Created

  • Is there anyone who can help me here? Thanks!

  • Thanks @acf-support
    I have the same in various groups, I have the same field called heading, I use this field to set the post title on 90% of my posttypes. using the field key would need me to define the key for each group, while if I do $my_post['post_title'] = get_field('heading'); it would the heading field on my contact field group, but also on my about field group for example.

    I’ve never had issues doing it this way.

    What’s you’re opinion about this?

  • hi @elliot
    Im running the latest version as well.

    I just tried the code on my staging site (not the local one) and it works! verified it on other installs as well.

    thank you very much for jumping in!
    I hope this function of mine will continue working now and won’t break again because of something
    Thanks!

  • Hi @elliot!
    Thanks for jumping in and elaborating what might go wrong, I really appreciate the help.

    I tried this function, it does save ‘kop’ field and taxonomies in my custom post types, however, with the post and page types, it behaves very strange:
    when creating a new one, it saves the kop fine, when updating it after creation, it does not update the field, but when updated the second time, it uses the value of the first update….. strange right? you can say it’s always ‘one behind’

    Do you need login credentials so you can see this yourself on my staging area?
    Thanks!

  • Thanks John!

    I will contact support.
    regarding Elliot’s quote, I got it from a support mail he sent me.

    Thanks for helping out!

  • Thanks @hube2! I completely understand, I changed my code to the following:

    //Auto add and update Title field:
    	
    	function my_post_title_updater( $post_id ) {
    
    	    $my_post = array();
    	    $my_post['ID'] = $post_id;
    
    	    $posttypes = array( 'post', 'portfolio', 'recensies', 'page' );
    	    $currentposttype = get_post_type();
    
    	    if ( in_array( $currentposttype, $posttypes ) ) { //only run if is certain post-type
    			if( $currentposttype == 'post' || $currentposttype === 'portfolio' || $currentposttype === 'page' ) {
    				$my_post['post_title'] = $_POST['acf']['field_56df22028f627'];
    			} elseif( $currentposttype === 'recensies') {
    				$my_post['post_title'] = $_POST['acf']['field_56dee620f84d5'] . ' (' . $_POST['acf']['field_56dee62cf84d6'] . ') - ' . $_POST['acf']['field_5734c3bcceb6c'];
    			}
    		    //Unhook function to prevent infitnite looping
    		    remove_filter('acf/save_post', 'my_post_title_updater', 1);
    
    		    // Update the post into the database
    		    wp_update_post( $my_post );
    
    		    //Rehook function to prevent infitnite looping
    		    add_filter('acf/save_post', 'my_post_title_updater', 1);
    		}
    
    	}
    	// run after ACF saves the $_POST['fields'] data
    	add_action('acf/save_post', 'my_post_title_updater', 1);
    

    now all my post_title updaters work, but my custom taxonomies are still not saved to the post, what are we missing here?

  • Thanks for the reply @hube2

    I lost you at this part:

    When you run the acf/save_post action with a priority of 1 you will need to use the $_POST['acf'] array to get the values of the other fields.

    can you help me out with that?

  • Thanks buddy! sorry for the late reply, but the priority solved the issue! very happy, thanks!

  • Hi James! Thanks for the help!

    it’s still not working though! neither for post neither for page only for cpt’s…..

    Im getting a little lost here, using a conditional statement (just to check):

    if ( $currentposttype == 'portfolio' ) {
          $my_post['post_title'] = get_field('kop', $post_id);
        }
    

    still seems to fire the updater when page or post and gets me the infinite loading with a No data received ERR_EMPTY_RESPONSE error in Chrome….

  • Awesome John!

    sorry, might have done better research myself.
    in my 5 minute search yesterday I could not find this hook!
    glad it’s here!

  • Thanks @hube2!

    this is sufficient for what I wanted, after seeing it to work, no need to prevent the rows from being edited.

    EDIT, by the way:
    'field_name' => 'Value for Field'
    should be
    'field_key' => 'Value for Field'

  • Hi John,

    I opened a ticket a while ago and still have no answer from them. any clues?

  • True!

    Unfortunately it does not work either with your edited function.

    One more detail, it loads the terms correctly to the ACF tax field, just not the other way – it does not update the terms with the acf field values

  • You’re right John! If I comment the function out, the whole sync works like it should…..
    Thanks for picking your brain on this!

  • Hi John,

    Thanks for jumping in again!
    I did some more debugging (should have done this more thorough before asking questions) and found out that this function is causing the issue (the one we resolved last time! remember?

    
    //Auto add and update Title field:
      function my_post_title_updater( $post_id ) {
    
      $my_post = array();
      $my_post['ID'] = $post_id;
      if ( get_post_type() == 'fotoslider' || get_post_type() == 'diensten' || get_post_type() == 'portfolio' || get_post_type() == 'partners') {
        $my_post['post_title'] = get_field('kop');
      }
    
      //Unhook function to prevent infitnite looping
      remove_filter('acf/save_post', 'my_post_title_updater', 20);
    
      // Update the post into the database
      wp_update_post( $my_post );
    
      //Rehook function to prevent infitnite looping
      add_filter('acf/save_post', 'my_post_title_updater', 20, 3);
    
      }
    
      // run after ACF saves the $_POST['fields'] data
      add_action('acf/save_post', 'my_post_title_updater', 20);
    

    any clue on why it is causing the terms not to sync?

    Thanks!

  • Ahh yes!
    Thanks John!

    Changed my code to this:

    
    //Auto add and update Title field:
    	function my_post_title_updater( $post_id ) {
    
    		$my_post = array();
    		$my_post['ID'] = $post_id;
    		$my_post['post_title'] = get_field('kop');
    
    		//Unhook function to prevent infitnite looping
    		remove_filter('acf/save_post', 'my_post_title_updater', 20);
    
    		// Update the post into the database
    		wp_update_post( $my_post );
    
    		//Rehook function to prevent infitnite looping
    		add_filter('acf/save_post', 'my_post_title_updater', 20, 3);
    
    	}
    
    	// run after ACF saves the $_POST['fields'] data
    	add_action('acf/save_post', 'my_post_title_updater', 20);
    

    and now it finally works again!

    Thank you very much for guiding me to the solution John!

  • John! I found the issue after I did somme commenting out in my functions.php
    I had this function in there for a long time by now, seems that at this moment, it breaks the update process of anything related to post.php. Here’s the function:

    //Auto add and update Title field:
    	function my_post_title_updater( $post_id ) {
    
    		$my_post = array();
    		$my_post['ID'] = $post_id;
    		$my_post['post_title'] = get_field('kop');
    
    		// Update the post into the database
    		wp_update_post( $my_post );
    
    	}
    
    	// run after ACF saves the $_POST['fields'] data
    	add_action('acf/save_post', 'my_post_title_updater', 20);
    

    I use this function to update my post’s/page’s title field with an ACF field value, do you have any clue on why it breaks now?

    Thanks!

  • I found it in MAMP, I have the following line:
    display_errors = MAMP_display_errors_MAMP found out that it’s logged to a file as well, but I see no new entry to that file when my page updating fails.
    Why is Elliot or somebody else from ACF not jumping in this one? It’s a critical issue!

  • Hi John,

    Thanks for that! I have no experience with that, can you elaborate a bit more on changing php.ini to do this? I already did a reinstall, did not work

  • I understand, I did sent a support ticket but have not yet received a reply.
    Thanks for trying to help me out! Im heavily hoping the someone from the team will help me out with this!

  • Thanks for the reply John,

    I Put the ini_set('display_errors', 1); line right below my opening <?php tag in post.php. Still nothing visible error-wise while updating pages?
    Do you need a copy of my database and files in order to check this out yourself? If you give me an email via private message I will send you the db dump and copy of the complete WordPress folder.

    Thanks!

  • Hi John,

    Ive done a completely new local install of WordPress, I only installed ACF Pro and copied the theme from my original site to this new one and activated it.

    so in other words, everything is brand new, except for the theme.
    Now when I try to update a page, I still have the same white screen of death, this time without ANY error notice….
    some more info:

    – When I enable twentyfifteen theme and ACF Pro, and and create a field group to appear on all pages, and create a new page with custom fields in it, it works!

    here’s an important one:
    – With my custom theme and ACF Pro enabled, no field groups assigned to pages (just basic title and WYSIWYG editor), creating and updating pages works…..

    Again, I have this on multiple sites now, so it’s not just a one website situation.

    Any further clues?

  • Thanks for jumping in John, unfortunately, nothing helps.
    I have this on multiple local and server installations right now! what on earth can cause this?
    I get these errors when updating a page with debug on:

    
    Notice: De aangeroepen constructor methode voor WP_Widget is verouderd sinds versie 4.3.0! Gebruik
    __construct()
    in plaats daarvan. in /Users/boriskamp/Documents/Local Websites/remons_barbershop/wp-includes/functions.php on line 3457
    
    Warning: Cannot modify header information - headers already sent by (output started at /Users/boriskamp/Documents/Local Websites/remons_barbershop/wp-includes/functions.php:3457) in /Users/boriskamp/Documents/Local Websites/remons_barbershop/wp-admin/post.php on line 242
    
    Warning: Cannot modify header information - headers already sent by (output started at /Users/boriskamp/Documents/Local Websites/remons_barbershop/wp-includes/functions.php:3457) in /Users/boriskamp/Documents/Local Websites/remons_barbershop/wp-includes/pluggable.php on line 1207
    

    any clues? it’s all in the WordPress files, I don’t understand this at all, how can this happen?
    I tried manually overwriting the server files with clean new ones as well and nothing helps.
    I need this fixed, this is unacceptable to my clients, just because of an update.

    What can I do figure this out some more?

  • My problem is solved by now, do you have proper field keys? My field keys were messed up due to a automatic slug generating function in my functions.php

Viewing 25 posts - 1 through 25 (of 36 total)