Support

Home Forums Event Espresso Premium Fatal error: Call to undefined function get_preview_post_link() – Urgent!!

Fatal error: Call to undefined function get_preview_post_link() – Urgent!!

Posted: December 13, 2016 at 2:46 pm

Viewing 5 reply threads


mischgo

December 13, 2016 at 2:46 pm

Hi when i try to add a new “venue” or “event” if getFatal error: Call to undefined function get_preview_post_link() in /home/path removed by me/wp-content/plugins/event-espresso-core-reg/core/admin/EE_Admin_Page_CPT.core.php on line 481

reinstalled the plugin multiple twice
last install via. ftp.

WordPress 4.2.10

switched back to default themes

still the same


Josh

  • Support Staff

December 13, 2016 at 2:55 pm

Hi there,

Your site will need at least WordPress 4.4 in order to have the get_preview_post_link() function defined.


mischgo

December 13, 2016 at 3:45 pm

Hi Josh

Thank you for your quick response.
It seems your version 4 is compatible with WordPress 4.1 and up.
And table view Requires Event Espresso 4.3 or higher (it CANNOT be used on earlier versions).

Is there a scenario where we can combine those two worlds?
What wordpress verions does Event Espresso 4.3 support?
Thanks


mischgo

December 13, 2016 at 4:40 pm

Requirements for the Event Espresso plugin for WordPress. Our ticketing software performs very well under a Linux web server running Apache or Nginx.
Event Espresso 4
PHP 5.3.9+
MySQL 5.0+
WordPress 4.1+

From youre requirements

https://eventespresso.com/requirements
Requirements


Josh

  • Support Staff

December 14, 2016 at 8:29 am

I gather that you’re not going to update to the current version then?

So what you would need to do is add a shim to your site:

if( ! function_exists('get_preview_post_link') ) {
function get_preview_post_link( $post = null, $query_args = array(), $preview_link = '' ) {
    $post = get_post( $post );
    if ( ! $post ) {
        return;
    }
 
    $post_type_object = get_post_type_object( $post->post_type );
    if ( is_post_type_viewable( $post_type_object ) ) {
        if ( ! $preview_link ) {
            $preview_link = set_url_scheme( get_permalink( $post ) );
        }
 
        $query_args['preview'] = 'true';
        $preview_link = add_query_arg( $query_args, $preview_link );
    }
 
    /**
     * Filters the URL used for a post preview.
     *
     * @since 2.0.5
     * @since 4.0.0 Added the <code>$post</code> parameter.
     *
     * @param string  $preview_link URL used for the post preview.
     * @param WP_Post $post         Post object.
     */
    return apply_filters( 'preview_post_link', $preview_link, $post );
}
}

You can add the above to a functions plugin or into your WordPress theme’s functions.php file. Then later on, if you ever end up maintaining your site and updating to a current version of WordPress, you can remove the shim.


mischgo

December 14, 2016 at 9:16 am

Hi Josh
Thank you for your help and suggestions – we where forced to use an older version of WP cause of the theme in use.
We organized (after some digging – thats why the longer silence) a newer versions of the theme now and upgraded WP.
Works like a charm now.
Great support and thanks again.

Best regards – will mark it as solved

Viewing 5 reply threads

The support post ‘Fatal error: Call to undefined function get_preview_post_link() – Urgent!!’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso