Get the object ID by URL

Try this function: url_to_postid( $url ); The WordPress codex is your friend. A quick Google search could have provided the answer.

Add link on the top menu of the post table?

They are filtered via the views_[screen-id] filter. The screen-id of the edit post page is edit-post, so you can modify the links like this: add_action( ‘views_edit-post’, ‘wpse17484_views_edit_post’ ); function wpse17484_views_edit_post( $views ) { $views[‘wpse17484’] = ‘<a href=”https://wordpress.stackexchange.com/questions/17484/my-url”>My action</a>’; return $views; } You can see the code that generates the post views in WP_Posts_List_Table::get_views().

How to add a custom button to the tinyMCE toolbar?

Your problem i believe are the lines that follow the enqueues and print scripts, you’re mixing Javascript with PHP.. Javascript goes inside the HTML section of a PHP file or inside an echo statement. This page of the codex gives an example for adding a button to TinyMCE inside WordPress. However that codex entry might … Read more

Change WordPress post-state in Admin Area

Your function doesn’t return a value, so you are effectively wiping the existing states. Also, this hook passes you the current post as an object, so you can use that instead of the global $post. Additionally get_page_templ‌​ate_slug returns a path that is relative to your theme’s root, so if your theme directory is called Lef-en-Liefde … Read more

Find most recent authors

Use a custom SQL query to grab the latest 16 post IDs with unique authors; $post_IDs = $wpdb->get_col( “SELECT ID FROM $wpdb->posts WHERE post_type=”product” AND post_status=”publish” GROUP BY post_author ORDER BY post_date DESC LIMIT 16″ ); Then start up a new query with the post__in argument; $recent_posts = new WP_Query( array( ‘post__in’ => $post_IDs, ‘post_type’ … Read more

How to disable edit post option after period of time?

Ok! @Kieran and @Rarst, here it is 🙂 function stoppostedition_filter( $capauser, $capask, $param){ global $wpdb; $post = get_post( $param[2] ); if( $post->post_status == ‘publish’ ){ // Disable post edit only for authore role if( $capauser[‘author’] == 1 ){ if( ( $param[0] == “edit_post”) || ( $param[0] == “delete_post” ) ) { // How much time … Read more

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