wp_insert_posts Fatal error: Maximum function nesting level of ‘100’ reached, aborting!

Fixed the problem I’ve added this line before the insertion of the posts. remove_action(‘save_post’, __FUNCTION__); final code: add_action(‘save_post’, ‘save_post_func’); function save_post_func(){ remove_action(‘save_post’, __FUNCTION__); include_once(ABSPATH . WPINC . ‘/feed.php’); $rss = fetch_feed($url); if (!is_wp_error($rss)) { $maxitems = $rss->get_item_quantity(5); $rss_items = $rss->get_items(0, $maxitems); foreach ($rss_items as $item) { wp_insert_post(array(‘post_title’ => ‘a’)); } } }

Custom Post Type & Author not associating, user post count is 0, api doesn’t return author in post objects

There was an associated post to this one that shed light on this answer. When registering the post type, I was not setting enough fields in the ‘supports’ array of the register_post_type. Adding author, whatdayaknow, gives me the data I’m looking for. Thanks to @milo for being on the right path! register_post_type(self::POST_TYPE, array( ‘labels’ => … Read more

wp_insert_post does not write my post_name

Gr8 job… only thing missing is the action and the timing for it to work… try this: $ins_home = array( ‘post_title’ => ‘Home’, ‘post_name’ => ‘my-home-site’, ‘post_status’ => array(‘publish’), ‘post_type’ => ‘page’, ‘comment_status’ => ‘closed’, ‘ping_status’ => ‘closed’ ); $ins_home_id = wp_insert_post($ins_home, 10, 1); $result = $wpdb->query(“SELECT wpost.post_name FROM $wpdb->posts wpost WHERE wpost.post_name=”my-home-site””); if($result < … Read more

Cropping an image before inserting into a post

I think you are good, but you don’t need to use other functions. You have all in File: wp-includes/media.php For instance, you may _wp_get_image_size_from_meta to get the image dimensions, so you don’t need to use something like this: $size = getimagesize($file); $width = $size[0]; $height = $size[1]; $mime = $size[‘mime’]; To get the image dimensions … Read more

How I upload, save and set a featured image from my frontend?

sorry this isn’t an answer but you need to sanitize that user input. Your allowing tags to be written directly into your post content which allows anyone to run javascript in both wp admin and on the front end of your site (assuming you’ll eventually print these posts). highly recommend (at minimum) strip_tags() or htmlspecialchars() … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)