Questions tagged [id]

A unique identifier.

61 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
3
votes
0answers
55 views

Showing random content / pictures from earlier posts in a sticky post?

I have a sticky post on my wordpress blog, in the beginning. I would like to place some random content in it, by simply replacing some HTML in the post content. The random content would come from ...
2
votes
2answers
296 views

WordPress plugin Write User/staff ID as the same as the WordPress User ID

I have a question in regards to a WordPress plugin (Bookly) that creates a Staff ID for an already created WordPress user, and hopefully, somebody may be able to help me with. Currently Bookly adds ...
2
votes
1answer
335 views

Get Post ID with insert/edit link

Hi I want to get the post ID from the post selected in the insert/edit link button. I would normally do: <a data-id="<?php echo $post->ID; ?>" href="<?php the_permalink();?&...
2
votes
0answers
61 views

URL scheme to retrieve tag archive by ID

You can retrieve a category archive by using a URL scheme like https://example.com/?cat=123. This even works if pretty permalinks are enabled. What is the equivalent query string for tags?
2
votes
0answers
190 views

Passing the page ID to a login php script

I'm trying to create a simple registration process which goes like this, A visitor clicks on a link (which is viewable only after entering some information such as name, email, phone etc.) This link ...
1
vote
0answers
19 views

How to get the upcoming post ID from front end?

Searching with "Next Post ID" is giving me the Previous/Next Post Navigation, but my question is not related to that. In WordPress Admin panel, when we're attempting to create a new post the post is ...
1
vote
0answers
75 views

Is there an equivalent of the PHP function sanitize_key in Gutenberg?

In WordPress's PHP library there is a function sanitize_key used to generate database keys and HTML IDs. I'd like to generate a slug from a title that can be used as an HTML ID, from within a ...
1
vote
1answer
141 views

Query Post Object in WP Admin

How can I fetch the details of the $post object of the very post that I'm working on in WP admin? I've tried global $post but I believe that $post is not available during editing. A little context: ...
1
vote
0answers
333 views

How to get next post ID?

Here is get_next_post function. But it gets next post only in main query. I want to get next post id by current ID. ie. my current id is 456 and get nextPostId('456') it must return 457 Is it ...
1
vote
0answers
463 views

Open post-content in archive page in a Modal box with bootstrap

on my archive page, i m trying to display the post content in a modal box ( using bootstrap). I manage only to display the first post in a modal box, nothing happen if I click on the other posts from ...
1
vote
0answers
31 views

Post ID randomly printing on page

I'm getting and looping through some custom post types, and have no idea why the post ID is printing to the page--I have been looking at this forever now! My code is: $args=array('post_type'=>'...
1
vote
0answers
132 views

Search results posts_orderby and ID

I'm using this function for customizing search results: function order_search_by_posttype( $orderby ) { if( ! is_admin() && is_search() ) : global $wpdb; $orderby = "CASE WHEN ...
1
vote
0answers
829 views

Change id=“respond” to the comments container

On the same page, I have 3 comment threads. Each comment has a meta that tells in which tread they have to be displayed in. At the end of each thread, I have a form to post a comment in this specific ...
1
vote
1answer
154 views

How to create a dashboard widget for one user

I will start by warning you that my programming skill is limited. I need to create a dashboard widget that will display in the WP dashboard for the users with the user_id=21. So far I have tried the ...
1
vote
1answer
266 views

How to call widget by widget's id?

Is it possible to call widgets using it's id? for example I have a sidebar. In this sidebar I put meta widget and tag cloud widget. I have got their id's ($widgets_list): 'meta-2' and 'tag_cloud-2'. ...
1
vote
1answer
410 views

Retrieve post ID from “querying” URL

Disclaimer: I can't post more than two links, yet... I know there are many similar questions, but none of the solutions work for me. My problem is that with the Live Composer Plugin (wordpress.org/...
0
votes
0answers
11 views

Set a numeric range for post ID generation based on post type?

I'm wondering if there's any way to configure WordPress to assign post IDs like so: Pages ID range: 10000 to 19999 Posts ID range: 20000 to 29999 Custom post type 'A' ID range: 30000 - 39999 Custom ...
0
votes
0answers
22 views

Trying to get post ID outside loop on blog page

I have a blog index page which only lists 1 custom post at a time on the index page (it is paginated). I am trying to get the ID of that post from outside the loop (in the footer, after the loop) but ...
0
votes
0answers
18 views

Is it possible to add the product id, to each item, in the cart table with WooCommerce?

I have my cart page working fine, but I need each item to have a class with its id or category (because I need to add some css only to certain products). Is this possible? Thank you.
0
votes
0answers
16 views

Reuse old post ID for new post after deleting post

I want to Reuse old post ID for new post after deleting some post. I have a site that has Q&A and I displayed the post ID before the title of each question so that the user / I can guess how many ...
0
votes
0answers
49 views

How to use current post ID in pods single value widget?

How can I get the current post slug (or ID) to view a simple pods field in a widget? I really can't find a way to do it. In the single field pods widget there are 4 fields: Title (I can leave it ...
0
votes
0answers
229 views

Trying to get property 'ID' and 'post_author' of non-object error

time. Last week I updated to version 7.0 of php and from there it is giving me the following errors: Notice: Trying to get property 'ID' of non-object in web_URL/wp-content/themes/stellenportal/tool-...
0
votes
1answer
10 views

How to only get the content of post page while looping?

so I am working with wordpress and I created a calendar with events (custom post_type). I have a page which shows the calendar with all the event dates from this post_type which works fine. Now I want ...
0
votes
0answers
38 views

get_current_user_id() always return 0 in if else statement

I'm trying to get logged in user id after if else statement but always return 0. When i put get_current_user_id() before it gives correct user id. How can I make it work in if statement? <?php ...
0
votes
0answers
28 views

How to get the url of the entry in which an image belongs

I'm creating a custom attachment template in WordPress, so far so good, but I would like to show the url of the entries or articles where that image belongs somehow? <div class="entry-attachment"&...
0
votes
1answer
45 views

Append USER ID to an outbound link?

Please bear with me as I am a newbie. Is there a way to append a USER ID aka a logged-in user's ID to any external link. For example, a logged-in user clicks a link, the link then appends that user'...
0
votes
1answer
25 views

Get Current Post ID in WP Loop For GiveWP

How to get current ID for WP Loop in my case? I try to loop the GIVEWP (Success), then I try to echo shortcode of GOAL Progress Bar of GiveWP but the problem is, i don't know how to get the current ...
0
votes
0answers
38 views

Pass post ID to wp_update_post

Need your help. I have created a custom post type and have a list table of the latest 10 posts. I need to change the post status of those post which I check a checkbox. However, I can not figure out ...
0
votes
0answers
13 views

Consequence of the post auto incrementer off?

I'm moving a site with specific post IDs. If I programatically make a post with postID "4", and the autoincrementer is at "3", what are the consequences? Would it just skip to "5", overwrite 4, or ...
0
votes
0answers
108 views

WooCommerce: add product description in Composite Products component

I'm currently trying to show the product description inside the components of the Composite Products plugin. The Javascript option_id already throws out the right id-number at the right spot when ...
0
votes
0answers
33 views

Safely changing UserID's, re-using deleted UserID's and automatically using deleted userID's instead of an increment

I'm looking for 3 different solutions all relating to user ids, I'm needing a solution to safely make changes without destroying the site. Issue 1: I am wanting to change the userID of a user from ...
0
votes
1answer
184 views

Get post attachment with post id

I have a form where user can upload a file, which creates a post with an attachment. I would like to get this attachment with post id, because this is the only thing I have in my case. Is it possible ?...
0
votes
0answers
132 views

Wordpress user ID prefix

Anyone know of a way to add a prefix to the WordPress user ID when the user registers via WooCommerce checkout? This new user ID format would need to be stored in the WP database in the default user ...
0
votes
1answer
169 views

get_post_meta not working with variable as a post_id for dynamically get the postid

I would like to use the get_post_meta to pull a value from a CPT dynamically and then send a email. The problem is that the get_post_meta($post->ID, ... part of the code does not pull the email ...
0
votes
0answers
17 views

send page ID's to another template

I have created a page called Projects. I then created 4 pages that are children of the projects page. I have some code that creates a link on all of the children pages that when clicked, will take you ...
0
votes
1answer
141 views

How can i take all ids from untrash_post action?

When the user chooses to restore a post ( from "Trash" folder ) with the following way, through the action untrash_post, i get the id of the posts. function my_untrash_post_type( $post_id ) { ...
0
votes
1answer
88 views

How do I apply a wordpress function to something with no ID inside an archive page?

Inside of an archive page I have multiple boxes. In those boxes I want to add a star rating, but I don't want to create a separate post for each of these boxes, I only want to make the boxes manually. ...
0
votes
2answers
4k views

How to get widget content in Wordpress based on it's ID?

I need to parse widget content based on it's ID. But a widget works like a function that pulls data based on it's arguments, right? So when I pull the widget data, I can only get it's arguments, not ...
0
votes
1answer
192 views

Get Post ID in Admin Edit screen otherwise generate it?

My plugin on a special projects custom post type admin add/edit screen requires to have the post ID. When on this CPT admin add/edit screen I would like to get the ID in PHP if it exist already. If ...
0
votes
1answer
35 views

Surrogate ID for posts, is there an alternative field in the posts table?

I am copying some content between another CMS and Wordpress. I need to keep track of the original Id because I might have to update the copied content in the future. The old CMS will still be used for ...
0
votes
1answer
39 views

Retrieve ONLY mp3s and set a variable for use in a playlist called by single.php template?

I'm trying to stuff a variable called $work_ids with the ID of any attached MP3 files for use in a custom player (based on MediaElement.js if that matters). The library contains WAV and other versions ...
0
votes
0answers
135 views

Getting wrong ID

I have a page template with a custom query. The query displays posts from a post type. I want to display the ID's of the queried posts, but when I use this... <?php $id = the_ID(); ?> All I ...
0
votes
1answer
30 views

CPT posts in drop downed in meta box on page doesn't return post ID

I have an issue with displaying ID of selected post. Could you guys help? thanks Function below add_action( 'add_meta_boxes', 'cd_meta_box_add' ); function cd_meta_box_add() { add_meta_box( 'my-...
0
votes
2answers
612 views

Is it possible to have dynamic post id # in add_menu_page()?

I use the add_menu_page function in my custom theme builds but when I export my local copy of the site and import it in the production site some of post id numbers change and I have to update this ...
0
votes
2answers
855 views

Generate unique number when registering a new user

I know there are userID, username in the database, but I want a formatted and unique number for physical world use. For example: "2014xxxx" 201414:year,xxxx:generate randomly when registering a user. ...
0
votes
1answer
132 views

Subcategory IDs in relation to parent category ID switch case

I would like to switch ads tags in my footer depending on which category it displays at the moment. Code from below works fine for custom category pages and category pages that are included in the ...
0
votes
1answer
91 views

Is there a function to search for a wildcard value when calling a shortcode?

I'm using a plugin to generate a form and rather than inserting the form on to the page using the content editor I'm adding it directly to my template. The problem is that on my local version the id ...
0
votes
1answer
91 views

main menu page redirects to user ID

I have a site that displays fitness results to clients. It works by showing them a page based on their UID displaying unique charts and graphs etc. I can redirect members to the unique pages on ...
0
votes
2answers
432 views

Get page content by ID (from a plugin)

I'm stuck on loading page content by id (through a plugin). What I have is the following: <?php $my_query = new WP_Query('page_id=39'); ?> <?php while ($my_query->have_posts()) : $...
0
votes
1answer
211 views

add anchor tags rel to thumbnails id

Ok, I have a very simple problem. but I'm not good with php, so posting here. the anchor tags of my portfolio items output like this: <a href="http://localhost/dianero/portfolio/kahida/" rel="41"&...