The tag has no usage guidance.

learn more… | top users | synonyms

1
vote
0answers
25 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 ...
0
votes
1answer
44 views

How to get a post's content? [on hold]

I'd like to known what is the best solution for getting a sepecific post's content. By slug, tag, id or category ? Or template assigned to this post ? I don't like the way to find this post by its id ...
0
votes
1answer
11 views

List sub pages with custom field content converting image ID to URL

I am using the ACF plugin to create static (non-ecommerce) product pages. I am now making a page that lists all the sub pages with product name and the image added to the product_logo custom field. I ...
0
votes
1answer
36 views

echo esc_url( get_permalink($post->ID) + complete the ID's url

I am in a deep trouble I try to only display the content of a post after clicking a bouton in order to not have the header and the footer again. Manually I have downloaded the plugin "Show Content ...
0
votes
1answer
23 views

Search by Attachment ID

I'm building a stock photo page for my company where we upload all photos our staff created so that it can be used later. It shows the ID of the image by post->ID so that users can see it, note it and ...
1
vote
1answer
33 views

How to get ID of images used in gallery?

How to get ID of images used in gallery? Using $gallery = get_post_gallery_images( $post ); I only get a string with thumbnails url, without image ID which is needed for basically everything. ...
1
vote
1answer
52 views

pass user id in slug and get user information

I have user id and I am getting all information using user id on page with slug. When I pass the user id in slug then I am not getting user information on page. For example I have ...
-1
votes
1answer
30 views

Custom post page has attributes of latest post [closed]

When you share the custom post page, it shows title, description, author of latest post. Even page ID is from latest post. Does it supposed to work like that? Besides this, it causes many other ...
0
votes
1answer
13 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
72 views

How to get specific page screen ID

Is it possible to get the screen id of a specific page? I've search on google and couldn't find anything related to specific page screen ID I'm not looking for the get_current_screen() ID or the ...
0
votes
1answer
32 views

Why I can not I use the variable outside my function?

I am writing a little plugin, to extract the post ID and them use it for some queries. Of course if I write: function my_callback_function() { $aa = 'hello world!'; echo $aa; } ...
0
votes
0answers
64 views

How to pass multiple page ids from a custom field variable into post__in wp_query

I have a client that wants to pull content from multiple pages using page_ids listed in a custom field (363, 87, 95) without interfering with the main loop content (can't use sub-pages as same page ...
0
votes
1answer
46 views

Getting an ID from a URL, why can WP do this itself, but none of of the functions provided get it right?

I have a set of absolute URLs that have been used to refer to my site (they come from redirects in an old .htaccess file in this case). All of these URLs do resolve to some page or post on the site. ...
-1
votes
2answers
30 views

get_pages gives wrong ID for blogpage

I have a problem with get_pages. It displays the wrong ID for the blog page. I have tried this code. $pages = get_pages(array("echo" => 0)); foreach($pages as $page){ echo $page->ID; } ...
4
votes
2answers
178 views

What is an alternative to get_page_by_title()?

I'm coding a theme where I want to display information in the footer that's only available on a template page. I have been using get_page_by_title() which works well if you know what the page will be ...
0
votes
1answer
36 views

retrieve permalinks of posts inside custom post type by using post ID

I have these custom post types registered as shown in the image below - In each of these custom post types, there are many posts. I have the function to retrieve the post IDs of each posts inside ...
0
votes
1answer
39 views

Buddypress activity id

I am working on buddypress activity loop. I want to get current activity id or all activity parameters in entry.php file. but i am not able to get activity id. I am trying to use ...
0
votes
2answers
683 views

Get the current post ID as a variable in Javascript

I'm trying to echo the post ID in a post Javascript and not having any luck. var post_id = '123'; // works fine var post_id = '<?php global $post; echo $post->ID; ?>'; // echos 'ID; ...
0
votes
1answer
28 views

Associating special meaning with user id 0

I'm writing a plugin that creates a custom table holding data which is linked to a user account with a user_id field. Now if that users account would be deleted for any reason I would like to set that ...
0
votes
0answers
16 views

Reverse Locate Gallery by ID - NOT ID but location on website!

This has befuddled me a few times and my searches only tell me how to find the ID of a gallery which I know. I am helping a friend with her Wordpress blog, I did not set up the site and I see she has ...
0
votes
1answer
78 views

Get the correct post id for all post and page in header.php

I want to get the current post/page id outside the loop (in header.php) and use this id for Advanced Custom Fields plugin to get the fields. But i cant get the correct id from front page, archive ...
0
votes
1answer
22 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
20 views

Sort products by products ID

is there a way to define an url like this one: http://www.mydomainname.com/product ID 1234 and product ID 5678 If yes which should be the correct syntax. Thanks for the help Roc
0
votes
0answers
61 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 ...
2
votes
2answers
185 views

Is post ID number always incremental n+

I have one question. Will WordPress always assign new post post ID which is incremental n+? For example if I delete some posts, will WordPress use ID of deleted post for new post added in future?
0
votes
1answer
22 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( ...
0
votes
2answers
120 views

How to get home page ID?

I'm building a Wordpress plugin in which I need to get the HOME page ID value. Do you know how can I get it? I know that we can get the current ID with the_ID() or get_the_ID() function, but I need ...
-2
votes
1answer
40 views

how can i get the page_ID in nav li [closed]

I need a menu with the page IDs of the linked Pages in the li Tags. It should look like that: <ul id="menu"> <li class="pageid_23"><a href="page1">Page 1</a></li> ...
1
vote
2answers
397 views

Get All IDs Of A Post Type Using WP_Query

I am trying to get a list of a custom post type's IDs using WP_Query, but it is returning undesired result, which is a memory leak and stuck browser. Here is the code I use: $the_query = new ...
0
votes
0answers
299 views

Generate auto seqential ID number when a new user is registered

First off I found this solution to what I would like to do: generate an auto incremented id number when a new user is registered It is almost there but I would like to extend the functionality a ...
2
votes
1answer
43 views

Does the menu item ID ever change?

Does the ID Wordpress gives each menu item ever change? id="menu-item-1234" I've linked to it within my CSS, however this will be no use if this ID may change, for instance when the page is ...
0
votes
3answers
50 views

Custom post type returns bad post ID

I added custom post type and I have first problem. I don't know why but if I use $post->ID, independently of post ID it always gave me the same value. I'm using this function <?php the_post(); ...
0
votes
2answers
137 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
1answer
82 views

Set post tags using tag ID

I want to set post tags to a new value. Is there a way to use the tag ID to do it? The wp_set_post_tags only accepts the tag name or an array of tag names. <?php wp_set_post_tags( $post_ID, $tags, ...
0
votes
1answer
88 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
95 views

php return username of currently viewed author profile

I'm at a loss. I have profiles developed for my wordpress website, and I want to display content on my page-profile.php that is specific per user profile. I've looked all around the codex and only ...
0
votes
1answer
76 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
2answers
358 views

How to get page_id for url rewrite or how to use page slug for calling a page?

I would like to simply create an url rewrite that takes the third argument and matches it to its corresponding pages, ignoring the other two arguments. domain.com/argument1/argument2/page-slug = ...
0
votes
1answer
15 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
44 views

How to view WordPress' default category IDs?

It seems that Wordpress has default categories with default (and unchangeable) IDs. For example, the uncategorized category seems to always have an id of 1. Is this always the case? Is there any ...
0
votes
1answer
52 views

Get post or page id early

Is there a good solution to get the queried object id really early ... and i mean really early? I got a hook on after_setup_theme where i need to get the post or page id. ...
0
votes
1answer
1k views

generate an auto incremented id number when a new user is registered

First off I found this question: generate unique number when registering a user which is almost exactly what I need except I need the number generated to be auto incremented instead of random. I'd ...
0
votes
1answer
251 views

WP_Query custom field pass the post id

I'm using WP_Query with ACF(Advanced Custom Fields) I'm building a news portal, and I'm trying to pass related stories from 1 post which is top_story = true. In another WP_Query I want to print the ...
1
vote
2answers
680 views

Get a post_id where meta_value equals something in a serialized meta_value field

I'm storing CPT products' post IDs into CPT companies' post meta (meta_key = prefix_products). As a company can have multiple products, so I'm storing them into a PHP serialized array value. ...
0
votes
2answers
500 views

How to change WordPress user ID?

Is this enough to change the user ID? I'm doing this for security purposes, where the administrator has user ID=1 and I want to keep all posts, pages and content. UPDATE wp_posts SET ...
0
votes
1answer
71 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
3answers
104 views

Output Post ID for all nav_items

I seek a solution for my navigation in a new WordPress template that I'm developing. How can I output the unique post ID for every nav item? I want to create a one-pager (microsite) for a client. ...
1
vote
1answer
2k views

Can't get post ID in functions.php?

I need the current post id in a function , which I have written in functions.php. But I can't get the id . I have tried several method . Like get_the_ID() ; ----returns false global $post; ...
0
votes
2answers
215 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
92 views

Echo a list of all subscriber's user IDs

I'm a complete novice with php. Can anyone let me know the code to simply echo/print a complete list of all user IDs on my site who are 'subscribers' (and not to echo any other user data).