Title: PHP 8.1 problem + ACF
Last modified: August 9, 2023

---

# PHP 8.1 problem + ACF

 *  Resolved [nations112](https://wordpress.org/support/users/nations112/)
 * (@nations112)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/php-8-1-problem-acf/)
 * Hi,
    1. After update to PHP 8.1 calendar shows error: 
       **Warning**: Undefined array 
       key “holidays” in **/wp-content/plugins/xo-event-calendar/inc/event-calendar-
       widget.php** on line **235**
    2. I need a function in ACF
       – if the URL is filled in = redirect to the given url–
       If the URL empty, use original calendar URLThank you!

Viewing 10 replies - 1 through 10 (of 10 total)

 *  Plugin Author [ishitaka](https://wordpress.org/support/users/ishitaka/)
 * (@ishitaka)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/php-8-1-problem-acf/#post-16958530)
 * Hi,
 * 1.
 * I have confirmed this issue. We plan to fix it in the next version.
 * 2.
 * I don’t understand what the problem is. Could you please be more specific?
 *  Thread Starter [nations112](https://wordpress.org/support/users/nations112/)
 * (@nations112)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/php-8-1-problem-acf/#post-16958894)
 * Hi,
 * Do you know, when the new version will release?
 * ACF
   The link in the calendar normally goes to /akce/name_of_event (it define(‘
   XO_EVENT_CALENDAR_EVENT_POST_TYPE’, ‘akce’ );
 * We create in ACF custom field URL and we want custom URL if it is filled. 
   example
   redirrect to /news/name_of_post with WP post. if not filled, then normally /akce/
   name_of_event
 * And if it will be filled “-“, URL will be disabled for this post (no URL action
   in calendar widget)
   Is it possible?
 * 
   And last question. Can we change a color of every event in ACF?
 * Example: category has blue color, in ACF will be yellow, so event will be yellow.
    -  This reply was modified 2 years, 9 months ago by [nations112](https://wordpress.org/support/users/nations112/).
    -  This reply was modified 2 years, 9 months ago by [nations112](https://wordpress.org/support/users/nations112/).
 *  Plugin Author [ishitaka](https://wordpress.org/support/users/ishitaka/)
 * (@ishitaka)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/php-8-1-problem-acf/#post-16958977)
 * A fix will be released in a day or two.
 * Does ACF mean ACF Plugin? Unfortunately, this plugin does not have the ability
   to work with ACF.
 *  Thread Starter [nations112](https://wordpress.org/support/users/nations112/)
 * (@nations112)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/php-8-1-problem-acf/#post-16959038)
 * Custom ACF URL works with these function correctly.
 * function my_xo_event_calendar_events( $events, $args, $month_index ) { foreach(
   $events as &$event) { $url = get_field( 'リンク', $event['post']->ID ); $event['
   permalink'] = esc_url( $url ); } return $events; } if ( function_exists( 'get_field')){
   add_filter( 'xo_event_calendar_events', 'my_xo_event_calendar_events', 10, 3 );}
 * We just need a condition that if it is not filled in, will be used the original
   URL of event or the link in calendar will be deactivated. Dou you know any solution?
    -  This reply was modified 2 years, 9 months ago by [nations112](https://wordpress.org/support/users/nations112/).
 *  Plugin Author [ishitaka](https://wordpress.org/support/users/ishitaka/)
 * (@ishitaka)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/php-8-1-problem-acf/#post-16959102)
 * Is it like this?
 *     ```wp-block-code
       $url = get_field( 'リンク', $event['post']->ID );
       $event['permalink'] = esc_url( $url );
       ```
   
 * ↓
 *     ```wp-block-code
       $url = get_field( 'リンク', $event['post']->ID );
       if ( $url ) {
       	$event['permalink'] = esc_url( $url );
       }
       ```
   
 *  Thread Starter [nations112](https://wordpress.org/support/users/nations112/)
 * (@nations112)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/php-8-1-problem-acf/#post-16959162)
 * This is exactly what we need! Thanks very much!
 * Is possible to turn off the URL completely if, for example, we write “-“?
 *  Plugin Author [ishitaka](https://wordpress.org/support/users/ishitaka/)
 * (@ishitaka)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/php-8-1-problem-acf/#post-16959627)
 * Is it like this?
 *     ```wp-block-code
       function my_xo_event_calendar_event_title( $html, $event ) {
       	$url = get_field( 'リンク', $event['post']->ID );
       	if ( ! $url ) {
       		$url = $event['permalink'];
       	}
   
       	$title = ( $event['short_title'] ) ? $event['short_title'] : $event['title'];
   
       	$html = '<span class="month-event-title" style="color:#333; background-color:' . esc_attr( $event['bg_color'] ) . ';">' . $title . '</span>';
   
       	if ( '-' !== $url ) {
       		$html = '<a href="' . esc_url( $url ) . '" title="' . esc_attr( $event['title'] ) . '">' . $html . '</a>';
       	}
   
       	return $html;
       }
   
       if ( function_exists( 'get_field' ) ) {
       	add_filter( 'xo_event_calendar_event_title', 'my_xo_event_calendar_event_title', 10, 2 );
       }
       ```
   
 *  Plugin Author [ishitaka](https://wordpress.org/support/users/ishitaka/)
 * (@ishitaka)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/php-8-1-problem-acf/#post-16961271)
 * Released version 3.2.3 to fix an error message displayed in the event calendar
   widget. Please try.
 *  Thread Starter [nations112](https://wordpress.org/support/users/nations112/)
 * (@nations112)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/php-8-1-problem-acf/#post-16961704)
 * Hi,
 * It works well. Thanks very much again!
 * As a thank you I completely translated the plugin into Czech yesterday.
 *  Plugin Author [ishitaka](https://wordpress.org/support/users/ishitaka/)
 * (@ishitaka)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/php-8-1-problem-acf/#post-16961815)
 * I’m glad it worked out.
 * > As a thank you I completely translated the plugin into Czech yesterday.
 * Děkuji 😊

Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘PHP 8.1 problem + ACF’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/xo-event-calendar_4c5f7d.svg)
 * [XO Event Calendar](https://wordpress.org/plugins/xo-event-calendar/)
 * [Support Threads](https://wordpress.org/support/plugin/xo-event-calendar/)
 * [Active Topics](https://wordpress.org/support/plugin/xo-event-calendar/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/xo-event-calendar/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/xo-event-calendar/reviews/)

 * 10 replies
 * 2 participants
 * Last reply from: [ishitaka](https://wordpress.org/support/users/ishitaka/)
 * Last activity: [2 years, 9 months ago](https://wordpress.org/support/topic/php-8-1-problem-acf/#post-16961815)
 * Status: resolved