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

Add/Modify rel=canonical of all the pages of a wordpress website

You’ll want to prevent SEO plugins from adding a canonical meta tag, and then add your own canonical meta tag using wp_head filter (untested): add_action( ‘wp_head’, static function () { $url = trailingslashit( get_site_url() ); $url .= ltrim( $_SERVER[‘REQUEST_URI’], “https://wordpress.stackexchange.com/” ); printf( ‘<link ref=”canonical” href=”%s” />’, esc_attr( $url ) ); } );

How can i add a script with parameters?

Use wp_enqueue_script from your PHP code to register and enqueue a script. WordPress will then handle automatically adding the required script tags at the right place and you’ll be able to instantiate and use the API from your javascript. E.g. (untested, check the docs for your use case) wp_enqueue_script(‘googlemaps’, ‘https://maps.googleapis.com/maps/api/js?&key=KEY’);

wordpress media library description column

Use the nl2br() function (tested): function column_id_row( $columnName, $media_item ) { if ( ‘description’ !== $columnName ) { return; } $attachment_meta = get_post( $media_item ); echo nl2br( $attachment_meta->post_content ); } add_filter( ‘manage_media_custom_column’, ‘column_id_row’, 10, 2 );