Custom Fields – How can I remove the publish option for certain users

You can do something like this : function wpse_113057_hide_publish_buttons(){ $cpt=”your_post_type”;// can be post global $post; if($post->post_type == $cpt && current_user_can(‘members’) ){ echo ‘ <style type=”text/css”> .misc-pub-section, #delete-action { display:none; } </style> ‘; } } add_action(‘admin_head-post.php’, ‘wpse_113057_hide_publish_buttons’); add_action(‘admin_head-post-new.php’, ‘wpse_113057_hide_publish_buttons’); I did not find a hook to do this with some PHP. Hope this helps.

Fetch data from a WP page with same name as current username

According with docs, when you want to retrieve field attached to post using get_field / the_field you should pass a numeric ID as 2nd argument. You are passing a string. So your code should work if: $login = wp_get_current_user()->user_login; $page = $login ? get_page_by_path( $login ) : false; $field = $page ? get_field(‘my_custom_field’, $page->ID) : … Read more

Copy url from post_content to custom field

What you need to do is run a function that gets triggered when the “update” button is clicked on posts. I can’t guarantee that my attempt to isolate the shortcode was successful, ( I’m not too good at that stuff ), but you definitely get the idea here! add_action(‘save_post’, ‘save_details’); function save_details() { global $post; … Read more

Show or hide lang=”ur” in main element

It looks like this attribute is hardcoded into your body tag. You could adjust it with your own body_lang() function like this (untested) : <body <?php ( function_exists( ‘body_lang’ ) ) ? body_lang() : ” ;?> <?php body_class(); ?> > where you can define the following, in your functions.php file: /** * Display the language … Read more

How to Order Posts by Custom Fields?

var_dump your $args arguments: array(4) { [“cat”]=> string(7) “2,39,30” [“orderby”]=> string(14) “meta_value_num” [“order”]=> string(4) “DESC” [“meta_key”]=> string(12) “album_rating” } The second time you use a key, you overwrite the first time. You cannot build the array like that. The orderby parameter will take a space separated string, so this is closer: $args = array( ‘cat’ … Read more

Custom field value link title

You would probably make life much easier for yourself if you stored Post IDs as your custom meta value, rather than post URLs; that said, you can try back-tracing the Post ID using url_to_postid(), then get the post object from the ID, then get the post title: // Your original code here $custom_fields = get_post_custom($post_id); … Read more

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