Support

Account

Forum Replies Created

  • Hi,

    It’s a really old post but a solution with ACF 4 and a page link field is to create a new field type in a plugin or in functions.php of the theme. I suppose it can be done with a post field too. Here’s an example :

    
    class acf_field_page_link_multisite extends acf_field_page_link
    {
    
      function __construct()
      {
        // vars
        $this->name = 'post_object_multisite';
        $this->label = __("Page Link Multisite",'acf');
        $this->category = __("Relational",'acf');
        $this->defaults = array(
                           'post_type' => array('all'),
                           'multiple' => 0,
                           'allow_null' => 0,
    		      );
    
        // do not delete!
        acf_field::__construct();
      }
    
    	function create_field( $field )
    	{
              // Switch to the blog you want
    	  switch_to_blog(5);
    	  parent::create_field($field);
    	  restore_current_blog();
    	}
    
    	function create_options( $field )
    	{
    	  switch_to_blog(5);
    	  parent::create_options($field);
              restore_current_blog();
    	}
    
    	function format_value_for_api( $value, $post_id, $field )
    	{
    		switch_to_blog(5);
    		$value = parent::format_value_for_api($value, $post_id, $field);
    		restore_current_blog();
    		return $value;
    	}
    
    }
    
    new acf_field_page_link_multisite();
    
Viewing 1 post (of 1 total)