• Resolved vale0911

    (@vale0911)


    Warning: Use of undefined constant ‘aol_content’ – assumed ‘‘aol_content’’ (this will throw an Error in a future version of PHP) in /home/djdfd/www/myPage/wp-content/themes/ciib/functions.php on line 145

    Notice: Undefined variable: content in /home/djdfd/www/myPage/wp-content/themes/ciib/functions.php on line 145

    Notice: Undefined variable: features in /home/djdfd/www/myPage/wp-content/themes/ciib/functions.php on line 145

    Notice: Undefined variable: form in /home/djdfd/www/myPage/wp-content/themes/ciib/functions.php on line 145

    Notice: Trying to get property ‘post_type’ of non-object in /home/djdfd/www/myPage/wp-includes/post.php on line 6752

    Notice: Trying to get property ‘post_type’ of non-object in /home/djdfd/www/myPage/wp-includes/post.php on line 6753

    Notice: Trying to get property ‘ID’ of non-object in /home/djdfd/www/myPage/wp-includes/post.php on line 6757

    Notice: Trying to get property ‘post_type’ of non-object in /home/djdfd/www/myPage/wp-includes/post.php on line 6998

    Notice: Trying to get property ‘post_type’ of non-object in /home/djdfd/www/myPage/wp-includes/theme.php on line 3078

    Notice: Trying to get property ‘ID’ of non-object in /home/djdfd/www/myPage/wp-content/plugins/wp-fastest-cache/wpFastestCache.php on line 892

    Notice: Trying to get property ‘post_type’ of non-object in /home/djdfd/www/myPage/wp-includes/theme.php on line 3307

    Notice: Trying to get property ‘post_type’ of non-object in /home/djdfd/www/myPage/wp-includes/post.php on line 4652

    Notice: Trying to get property ‘ID’ of non-object in /home/djdfd/www/myPage/wp-includes/post.php on line 4652

    Notice: Trying to get property ‘post_type’ of non-object in /home/djdfd/www/myPage/wp-includes/post.php on line 4108

    Fatal error: Uncaught TypeError: Argument 2 passed to WPSEO_Link_Watcher::save_post() must be an instance of WP_Post, null given, called in /home/djdfd/www/myPage/wp-includes/class-wp-hook.php on line 290 and defined in /home/djdfd/www/myPage/wp-content/plugins/wordpress-seo/admin/links/class-link-watcher.php:47 Stack trace: #0 /home/djdfd/www/myPage/wp-includes/class-wp-hook.php(290): WPSEO_Link_Watcher->save_post(0, NULL) #1 /home/djdfd/www/myPage/wp-includes/class-wp-hook.php(312): WP_Hook->apply_filters(NULL, Array) #2 /home/djdfd/www/myPage/wp-includes/plugin.php(478): WP_Hook->do_action(Array) #3 /home/djdfd/www/myPage/wp-includes/post.php(4119): do_action(‘save_post’, 0, NULL, false) #4 /home/djdfd/www/myPage/wp-admin/includes/post.php(671): wp_insert_post(Array) #5 /home/djdfd/www/myPage/wp-admin/post-new.php(66): get_default_post_to_edit(‘aol_ad’, true) #6 {main} thrown in /home/djdfd/www/myPage/wp-content/plugins/wordpress-seo/admin/links/class-link-watcher.php on line 47

    The first warning and notice comes from this code inside functions.php

    add_filter(‘aol_content’, ‘my_custom_function’, 10, 3);

    function my_custom_function( $content, $features, $form ){
    //Modiy $content here
    $content = ‘<h1>’.get_the_title().'</h1>’.$content;
    return $content;
    }

    apply_filters( ‘aol_content’, $content, $features, $form );

    This works, but I don’t know if I did something wrong.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Farhan Noor

    (@farhannoor)

    Hi,

    add_filter('aol_content', 'my_custom_function', 10, 3);
    
    function my_custom_function( $content, $features, $form ){
    //Modiy $content here
    $content = '<h1>Hello World'.get_the_title().'</h1>'.$content;
    return $content;
    }

    Above code works perfect for me, no errors. However, You should not use apply_filters( ‘aol_content’, $content, $features, $form ); apply_filters() is used for declaring a new hook only.

    Best Regards
    Farhan

    Thread Starter vale0911

    (@vale0911)

    Hi,
    I removed
    apply_filters( ‘aol_content’, $content, $features, $form );
    and it seams to be working fine for men to.

    Thank you for explaining!

    I also fixed my other errors as they were not plugin related in the end.

    Kind regards,
    Valentina

    Plugin Author Farhan Noor

    (@farhannoor)

    Hi Valentina,
    Can you please write a review according to your experience for this plugin? Here is the link: https://wordpress.org/support/plugin/apply-online/reviews/

    Stay safe & healthy
    Farhan

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Can’t create a new ad’ is closed to new replies.