404 Error after URL update

You might have already done this, but while logged into the admin of your site, go to Settings > General and then review the urls in WordPress Address (URL) and Site Address (URL). If they do not read with the new domain name, then they need to be updated. Once you have the correct urls … Read more

Registered a REST Route but I’m Getting a 400 Bad Request

Make sure you’re reaching the correct endpoint by using rest_url(). When using the REST API and nonces, make sure that the nonce action is set to ‘wp_rest’. add_action(‘enqueue_block_editor_assets’, function () { $data = wp_json_encode(array( ‘restUrl’ => esc_js(rest_url(‘guide-posts/v1’)), ‘nonce’ => esc_js(wp_create_nonce(‘wp_rest’)) )); wp_add_inline_script(‘guide-posts’, “var guidePostsAjax = $data”); }); The permission_callback property is mandatory when registering a … Read more

I have issue with decoding json ex. ‘{“a”:”b”}’

One of two things is happening here: Invalid JSON If the value of $extra isn’t a properly-constructed JSON string, then json_decode( $extra ) is returning null. echo null; won’t print anything to the screen. Valid JSON If $extra is a valid JSON string, When you json_decode() it, you’ll get an object (specifically, a stdClass object). … Read more

Want to add custom post type for facebook feed

You need to add the post via function call wp_insert_post. where you need to pass the parameter of post type as name of your custom post type. $wordpress_post = array( ‘post_title’ => ‘Post title’, ‘post_content’ => ‘Post Content’, ‘post_status’ => ‘publish’, ‘post_author’ => 1, ‘post_type’ => ‘custom_post_type’ ); wp_insert_post( $wordpress_post ); Hope this helps

Check if User Meta has Existing Value

If I understand correctly, you are wanting to prevent duplicate IDs in the meta data: use the get_user_meta() function to retrieve the meta value and check it for the ID (untested): $meta = get_user_meta( $user_id, ‘saved_session’ ); if ( ! in_array( $post_id, $meta ) ) { add_user_meta( $user_id, ‘saved_session’, $post_id ); } For others that … Read more

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